Boost C++ Libraries: Ticket #534: problem with boost::algorithm::split https://svn.boost.org/trac10/ticket/534 <pre class="wiki">string str("*word1-word2*word3-"); vector&lt;std::string&gt; ResultCopy; split(ResultCopy, str, is_any_of("-*"), token_compress_on); for(unsigned int nIndex=0; nIndex&lt;ResultCopy.size(); nIndex++) { cout &lt;&lt; nIndex &lt;&lt; ":" &lt;&lt; ResultCopy[nIndex] &lt;&lt; endl; }; The output is: 0: 1:word1 2:word2 3:word3 4: Is this a bug? In my opinion the output should be: 0:word1 1:word2 2:word3 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/534 Trac 1.4.3 memring Mon, 12 Dec 2005 22:27:28 GMT <link>https://svn.boost.org/trac10/ticket/534#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/534#comment:1</guid> <description> <pre class="wiki">Logged In: YES user_id=635808 The current behaviour is not a bug, rather the former one was not correct. Based on the long discussion on both developer's and user's list, the implementation was changed to always return n+1 tokens where n is number of separators. No empty tokens are removed, event if they are on the endings of the input string. You can simulate the deprecated behaviour simply by trimming the input before the split operation. Just add boost::trim_if(str, is_any_of("*-") before split. Regards, Pavol </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>memring</dc:creator> <pubDate>Mon, 12 Dec 2005 22:27:29 GMT</pubDate> <title>status changed https://svn.boost.org/trac10/ticket/534#comment:2 https://svn.boost.org/trac10/ticket/534#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> Ticket