<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Leerzeichen aus einen String entfernen!]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte aus einen bestehenden string alle Leerzeichen entfernen hab es folgendermaßen probiert aber irgendwie funktioniert das nicht.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;

int main()
{
unsigned int i= 0;
std::string bsp_str = &quot;Das ist ein Test&quot;;
std::string temp_str = &quot;&quot;;
  while(i &lt; bsp_str.length())
  {
    if(bsp_str.compare(i , i+1, &quot; &quot;) == 0)
      temp_str += bsp_str[i];
    i++;
  }
std::cout&lt;&lt;temp_str&lt;&lt;std::endl;

return 0;
}
</code></pre>
<p>Ich hoffe es kann mir jemand weiterhelfen!<br />
Danke in vorraus!</p>
<p>mfg hugo</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/268296/leerzeichen-aus-einen-string-entfernen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 00:14:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/268296.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 07 Jun 2010 10:26:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Leerzeichen aus einen String entfernen! on Mon, 07 Jun 2010 10:26:00 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte aus einen bestehenden string alle Leerzeichen entfernen hab es folgendermaßen probiert aber irgendwie funktioniert das nicht.</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;string&gt;

int main()
{
unsigned int i= 0;
std::string bsp_str = &quot;Das ist ein Test&quot;;
std::string temp_str = &quot;&quot;;
  while(i &lt; bsp_str.length())
  {
    if(bsp_str.compare(i , i+1, &quot; &quot;) == 0)
      temp_str += bsp_str[i];
    i++;
  }
std::cout&lt;&lt;temp_str&lt;&lt;std::endl;

return 0;
}
</code></pre>
<p>Ich hoffe es kann mir jemand weiterhelfen!<br />
Danke in vorraus!</p>
<p>mfg hugo</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1908227</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1908227</guid><dc:creator><![CDATA[hugo_]]></dc:creator><pubDate>Mon, 07 Jun 2010 10:26:00 GMT</pubDate></item><item><title><![CDATA[Reply to Leerzeichen aus einen String entfernen! on Mon, 07 Jun 2010 10:28:44 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;algorithm&gt;
#include &lt;cctype&gt;
#include &lt;iostream&gt;

int main(int, char*[]){
    std::string test = &quot;xcvb uzxcuvibxcvb.- sdf.s ,sdfs.fsd fsdf.sdf:;sdfsdf&quot;;

    std::remove_if(test.begin(), test.end(), static_cast&lt;int(*)(int)&gt;(std::isspace));

    std::cout &lt;&lt; test &lt;&lt; std::endl;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1908229</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1908229</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Mon, 07 Jun 2010 10:28:44 GMT</pubDate></item><item><title><![CDATA[Reply to Leerzeichen aus einen String entfernen! on Mon, 07 Jun 2010 11:17:17 GMT]]></title><description><![CDATA[<p>edit: Mist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1908257</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1908257</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Mon, 07 Jun 2010 11:17:17 GMT</pubDate></item><item><title><![CDATA[Reply to Leerzeichen aus einen String entfernen! on Mon, 07 Jun 2010 11:17:03 GMT]]></title><description><![CDATA[<p>Deswegen: error: no matching function for call to ‘remove_if(__gnu_cxx::__normal_iterator&lt;char*, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, __gnu_cxx::__normal_iterator&lt;char*, std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; &gt;, &lt;unresolved overloaded function type&gt;)’</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1908258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1908258</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Mon, 07 Jun 2010 11:17:03 GMT</pubDate></item><item><title><![CDATA[Reply to Leerzeichen aus einen String entfernen! on Mon, 07 Jun 2010 11:24:42 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">test.erase(std::remove(test.begin(), test.end(), ' '), test.end());
</code></pre>
<p>Das nennt sich das <a href="http://en.wikipedia.org/wiki/Erase-remove_idiom" rel="nofollow">Erase-Remove-Idiom</a>.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1908266</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1908266</guid><dc:creator><![CDATA[seldon]]></dc:creator><pubDate>Mon, 07 Jun 2010 11:24:42 GMT</pubDate></item><item><title><![CDATA[Reply to Leerzeichen aus einen String entfernen! on Mon, 07 Jun 2010 13:04:36 GMT]]></title><description><![CDATA[<p>boost::algorithm::string bringt einen ganzen Haufen nützlicher string Funktionen mit, vielleicht kannst du die ja verwenden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1908334</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1908334</guid><dc:creator><![CDATA[DocShoe]]></dc:creator><pubDate>Mon, 07 Jun 2010 13:04:36 GMT</pubDate></item></channel></rss>