<?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[mehrere zeichenketten in string suchen]]></title><description><![CDATA[<p>Hallo alle zusammen,<br />
ich habe ein Problem. Ich möchte eine Zahl in einem String suchen. Das geht, nur wenn es eine Zahl mehrmals im String vorkommt, dann gibt er nur die erste Stelle aus.</p>
<p>[code]<br />
string text=&quot;1;11;2;2;2;22;123;&quot;, text2, auslagerung;<br />
int pos=0;</p>
<p>cout&lt;&lt;&quot;Unser String lautet: &quot;&lt;&lt;text&lt;&lt;endl&lt;&lt;endl;</p>
<p>pos = text.find(&quot;2&quot;); //Suchen von Zeichen<br />
cout&lt;&lt;pos&lt;&lt;endl;</p>
<p>Kenn vielleicht einer von euch vielleicht einen besseren Befehl oder wisst ihr wie ich das Problem lösen kann????</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/174063/mehrere-zeichenketten-in-string-suchen</link><generator>RSS for Node</generator><lastBuildDate>Fri, 18 Sep 2026 12:12:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/174063.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 Feb 2007 15:28:42 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to mehrere zeichenketten in string suchen on Thu, 22 Feb 2007 15:28:42 GMT]]></title><description><![CDATA[<p>Hallo alle zusammen,<br />
ich habe ein Problem. Ich möchte eine Zahl in einem String suchen. Das geht, nur wenn es eine Zahl mehrmals im String vorkommt, dann gibt er nur die erste Stelle aus.</p>
<p>[code]<br />
string text=&quot;1;11;2;2;2;22;123;&quot;, text2, auslagerung;<br />
int pos=0;</p>
<p>cout&lt;&lt;&quot;Unser String lautet: &quot;&lt;&lt;text&lt;&lt;endl&lt;&lt;endl;</p>
<p>pos = text.find(&quot;2&quot;); //Suchen von Zeichen<br />
cout&lt;&lt;pos&lt;&lt;endl;</p>
<p>Kenn vielleicht einer von euch vielleicht einen besseren Befehl oder wisst ihr wie ich das Problem lösen kann????</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1233397</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1233397</guid><dc:creator><![CDATA[ProfDok]]></dc:creator><pubDate>Thu, 22 Feb 2007 15:28:42 GMT</pubDate></item><item><title><![CDATA[Reply to mehrere zeichenketten in string suchen on Thu, 22 Feb 2007 15:41:37 GMT]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">string text=&quot;1;11;2;2;2;22;123;&quot;, text2, auslagerung;
cout&lt;&lt;&quot;Unser String lautet: &quot;&lt;&lt;text&lt;&lt;endl&lt;&lt;endl;

int pos = 0;
while ((pos = text.find(&quot;2&quot;, pos)) != string::npos)
{
  cout&lt;&lt;pos&lt;&lt;endl; 
  ++pos;
}
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1233408</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1233408</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Thu, 22 Feb 2007 15:41:37 GMT</pubDate></item><item><title><![CDATA[Reply to mehrere zeichenketten in string suchen on Thu, 22 Feb 2007 15:47:34 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">std::set&lt;std::size_t&gt; find_all (std::string const&amp; str, std::string const&amp; search)
{
    std::set&lt;std::size_t&gt; res;
    std::size_t pos = str.find (search);
    while (pos != std::string::npos)
    {
        res.push (pos)
        pos = str.find (search, pos + search.size())
    }
    return res;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1233410</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1233410</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Thu, 22 Feb 2007 15:47:34 GMT</pubDate></item></channel></rss>