<?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[String Replace]]></title><description><![CDATA[<p>Moin,</p>
<p>Ich habe folgendes Problem, ich möchte in meinem String \ durch \\ ersetzen.<br />
Durch googeln bin ich auf die Funktion replace gekommen in meinem Fall:</p>
<p>string exe = &quot;C:\folder\folder2&quot;; // Beispiel<br />
exe.replace(exe.find(&quot;\&quot;), strlen(&quot;\&quot;), &quot;\\\&quot;);</p>
<p>Doch leider wird nur der erste backslash ersetzt (C:\\folder\folder2).<br />
Wie kann ich wirklich ALLE backslashs ersetzen ?</p>
<p>Info: Ich habe bereits etliche Zeit damit verbracht eine Lösung zu finden doch leider will es nicht sorecht.</p>
<p>Vielen Dank,<br />
niroxx</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/154922/string-replace</link><generator>RSS for Node</generator><lastBuildDate>Tue, 08 Sep 2026 02:29:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/154922.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 31 Jul 2006 23:37:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String Replace on Mon, 31 Jul 2006 23:37:07 GMT]]></title><description><![CDATA[<p>Moin,</p>
<p>Ich habe folgendes Problem, ich möchte in meinem String \ durch \\ ersetzen.<br />
Durch googeln bin ich auf die Funktion replace gekommen in meinem Fall:</p>
<p>string exe = &quot;C:\folder\folder2&quot;; // Beispiel<br />
exe.replace(exe.find(&quot;\&quot;), strlen(&quot;\&quot;), &quot;\\\&quot;);</p>
<p>Doch leider wird nur der erste backslash ersetzt (C:\\folder\folder2).<br />
Wie kann ich wirklich ALLE backslashs ersetzen ?</p>
<p>Info: Ich habe bereits etliche Zeit damit verbracht eine Lösung zu finden doch leider will es nicht sorecht.</p>
<p>Vielen Dank,<br />
niroxx</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1108113</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1108113</guid><dc:creator><![CDATA[niroxx]]></dc:creator><pubDate>Mon, 31 Jul 2006 23:37:07 GMT</pubDate></item><item><title><![CDATA[Reply to String Replace on Tue, 01 Aug 2006 00:48:53 GMT]]></title><description><![CDATA[<p>1.) boost::algorithm::replace_all</p>
<p>2.)</p>
<pre><code class="language-cpp">void replace_all(string &amp;s, const string &amp;a, const string &amp;b)
{
    for (string::size_type i = s.find(a); i != string::npos; i = s.find(a, i + b.size()))
        s.replace(i, a.size(), b);
}

aufruf:
replace_call(str, &quot;\&quot;, &quot; &quot;);
</code></pre>
<p>cu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1108122</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1108122</guid><dc:creator><![CDATA[cpp1]]></dc:creator><pubDate>Tue, 01 Aug 2006 00:48:53 GMT</pubDate></item><item><title><![CDATA[Reply to String Replace on Tue, 01 Aug 2006 00:57:32 GMT]]></title><description><![CDATA[<p>Wunderbar, dankeschön !</p>
<p>Edit:<br />
Was kann ich mit Schritt 1 anfangen ? Wo einfügen ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1108125</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1108125</guid><dc:creator><![CDATA[niroxx]]></dc:creator><pubDate>Tue, 01 Aug 2006 00:57:32 GMT</pubDate></item><item><title><![CDATA[Reply to String Replace on Tue, 01 Aug 2006 06:08:35 GMT]]></title><description><![CDATA[<p>Du kannst die Funktion <em>replace_all</em> der Bibliothek <em>Boost</em> verwenden statt dir selbst was zu schreiben.<br />
Hierzu brauchst du natürlich genannte Bibliothek.</p>
<p>grüße</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1108157</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1108157</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Tue, 01 Aug 2006 06:08:35 GMT</pubDate></item><item><title><![CDATA[Reply to String Replace on Tue, 01 Aug 2006 08:52:36 GMT]]></title><description><![CDATA[<p>It seems this forum engine has problems translating between doubleslashes and slashes. I see different number of them in posts in normal mode and when I replay. In normal mode it seemed like some of posts had errors, in replay mode some of errors disappeared...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1108265</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1108265</guid><dc:creator><![CDATA[RoboTact]]></dc:creator><pubDate>Tue, 01 Aug 2006 08:52:36 GMT</pubDate></item><item><title><![CDATA[Reply to String Replace on Tue, 01 Aug 2006 09:34:50 GMT]]></title><description><![CDATA[<p>cpp1 schrieb:</p>
<blockquote>
<p>1.) boost::algorithm::replace_all</p>
<p>2.)</p>
<pre><code class="language-cpp">void replace_all(string &amp;s, const string &amp;a, const string &amp;b)
{
    for (string::size_type i = s.find(a); i != string::npos; i = s.find(a, i + b.size()))
        s.replace(i, a.size(), b);
}

aufruf:
replace_call(str, &quot;\&quot;, &quot; &quot;);
</code></pre>
<p>cu</p>
</blockquote>
<p>ineffizient</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1108302</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1108302</guid><dc:creator><![CDATA[.-]]></dc:creator><pubDate>Tue, 01 Aug 2006 09:34:50 GMT</pubDate></item><item><title><![CDATA[Reply to String Replace on Tue, 01 Aug 2006 09:39:28 GMT]]></title><description><![CDATA[<p>ich meinte unelegant wegen dem doppelten code für find</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1108310</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1108310</guid><dc:creator><![CDATA[.-]]></dc:creator><pubDate>Tue, 01 Aug 2006 09:39:28 GMT</pubDate></item></channel></rss>