Boost C++ Libraries: Ticket #1808: Trim middle https://svn.boost.org/trac10/ticket/1808 <p> Could you add a function to trim 'internal' whitespace? I think two functions would be handy, one for single-line data and one for multi-line data. The single-line one would replace all internal whitespace by a single space character. The multi-line one would replace multiple empty lines by a single empty line and remove trailing whitespace from each line. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1808 Trac 1.4.3 OlafvdSpek@… Thu, 10 Apr 2008 13:14:50 GMT <link>https://svn.boost.org/trac10/ticket/1808#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:1</guid> <description> <p> I hate Trac! Anyway, my email address is <a class="missing wiki">OlafvdSpek</a>@GMail.Com </p> </description> <category>Ticket</category> </item> <item> <author>olafvdspek@…</author> <pubDate>Wed, 16 Jun 2010 17:20:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1808#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:2</guid> <description> <p> Pavol? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 16 Jun 2010 17:23:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1808#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:3</guid> <description> <p> Sorry for not responding. Generally I can offer you a deal: You code it and I can integrate it into the library. I agree that the function is useful. I would only suggest to call it compress_spaces. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 16 Jun 2010 17:29:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1808#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:4</guid> <description> <p> Sounds fair. What should the multi-line version be called? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Pavol Droba</dc:creator> <pubDate>Wed, 16 Jun 2010 18:07:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1808#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:5</guid> <description> <p> Maybe the multi-line version is not realy necessary. You can replace it by two calls to the compress functions with different space specifications. </p> <p> Also try to think, how to handle different line endings (&lt;CR&gt;,&lt;LF&gt;,&lt;CR&gt;&lt;LF&gt;) If might be possible to define the compress function via means of find/replace framework. There is even one example in the library that does something similar. </p> <p> Send me an email when you will have something to show at droba -at - topmail -dot- sk </p> </description> <category>Ticket</category> </item> <item> <author>olafvdspek@…</author> <pubDate>Thu, 05 Aug 2010 13:23:57 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1808#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:6</guid> <description> <pre class="wiki">return ::boost::algorithm::find_format_all_copy( ::boost::trim_copy(v), ::boost::algorithm::token_finder(boost::is_space(), ::boost::algorithm::token_compress_on), ::boost::algorithm::const_formatter(" ")) </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 25 Nov 2010 17:46:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1808#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:7</guid> <description> <p> Pavol? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Thu, 30 Dec 2010 21:12:39 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/1808#comment:8 https://svn.boost.org/trac10/ticket/1808#comment:8 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.36.0</span> → <span class="trac-field-new">Boost 1.46.0</span> </li> </ul> Ticket olafvdspek@… Wed, 13 Apr 2011 17:23:28 GMT <link>https://svn.boost.org/trac10/ticket/1808#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:9</guid> <description> <p> Hi Pavol, </p> <p> What's the status of this issue? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Wed, 28 Dec 2011 18:51:28 GMT</pubDate> <title>owner, component changed https://svn.boost.org/trac10/ticket/1808#comment:10 https://svn.boost.org/trac10/ticket/1808#comment:10 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Pavol Droba</span> to <span class="trac-author">Marshall Clow</span> </li> <li><strong>component</strong> <span class="trac-field-old">string_algo</span> → <span class="trac-field-new">algorithm</span> </li> </ul> Ticket Marshall Clow Wed, 29 Feb 2012 20:27:43 GMT <link>https://svn.boost.org/trac10/ticket/1808#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:11</guid> <description> <p> Is there some reason that <code>boost::algorithm::trim_all</code> doesn't do what you want? </p> <pre class="wiki"> //! Trim All /*! Remove all leading and trailing spaces from the input and compress all other spaces to a single character. </pre> </description> <category>Ticket</category> </item> <item> <author>Olaf van der Spek <olafvdspek@…></author> <pubDate>Wed, 29 Feb 2012 20:36:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1808#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:12</guid> <description> <p> Hi Marshall, </p> <p> trim_all is the response to this request. ;) </p> <p> However, it's not quite right yet. It should compress all spaces to a single space, not a single character. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Wed, 29 Feb 2012 22:33:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1808#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:13</guid> <description> <p> And <code>trim_fill (blah, " ")</code> doesn't do that? </p> <pre class="wiki"> //! Trim Fill /*! Remove all leading and trailing spaces from the input and replace all every block of consecutive spaces with a fill string defined by user. </pre><p> I'm not trying to be a pain here, just trying to understand. </p> </description> <category>Ticket</category> </item> <item> <author>Olaf van der Spek <olafvdspek@…></author> <pubDate>Wed, 29 Feb 2012 23:53:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1808#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1808#comment:14</guid> <description> <p> Ah, yes, trim_fill was created to work around that problem. The original idea was for trim_all to do that from the start, without having to manually specify the 'fill' character/string. </p> </description> <category>Ticket</category> </item> </channel> </rss>