<?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[Gibt es substr_count in CBuilder?]]></title><description><![CDATA[<p>Hallo.</p>
<pre><code>[b]substr_count[/b]

[i](PHP 4, PHP 5)[/i]
substr_count --  Ermittelt, wie oft eine Zeichenkette in einem String vorkommt
Beschreibung
int substr_count ( string haystack, string needle [, int offset [, int length&rsqb;&rsqb; )

Die Funktion substr_count() ermittelt, wie oft needle in dem String haystack vorkommt, und gibt die Anzahl der Vorkommen zurück. Beachten Sie, dass der Parameter needle case sensitive ist.
</code></pre>
<p>Beispie: $anzahl = substr_count(&quot;hello world!&quot;,&quot;el&quot;);</p>
<p>Gibt es eine solche Funktion in CBuilder?<br />
Ich habe keine gefunden und angefangen mir selber was zu basteln, komme aber nicht weiter</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
int substr_count(AnsiString Text, AnsiString Sub);
{
    int anzahl = 0;
    for (int i=0;i&lt;Text.Lenght();i++)
    {
//.........
    }
    return anzahl;
}
//---------------------------------------------------------------------------
</code></pre>
<p>Kann mir da jemand helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/157439/gibt-es-substr_count-in-cbuilder</link><generator>RSS for Node</generator><lastBuildDate>Mon, 10 Aug 2026 11:44:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/157439.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 25 Aug 2006 16:53:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Gibt es substr_count in CBuilder? on Fri, 25 Aug 2006 16:53:48 GMT]]></title><description><![CDATA[<p>Hallo.</p>
<pre><code>[b]substr_count[/b]

[i](PHP 4, PHP 5)[/i]
substr_count --  Ermittelt, wie oft eine Zeichenkette in einem String vorkommt
Beschreibung
int substr_count ( string haystack, string needle [, int offset [, int length&rsqb;&rsqb; )

Die Funktion substr_count() ermittelt, wie oft needle in dem String haystack vorkommt, und gibt die Anzahl der Vorkommen zurück. Beachten Sie, dass der Parameter needle case sensitive ist.
</code></pre>
<p>Beispie: $anzahl = substr_count(&quot;hello world!&quot;,&quot;el&quot;);</p>
<p>Gibt es eine solche Funktion in CBuilder?<br />
Ich habe keine gefunden und angefangen mir selber was zu basteln, komme aber nicht weiter</p>
<pre><code class="language-cpp">//---------------------------------------------------------------------------
int substr_count(AnsiString Text, AnsiString Sub);
{
    int anzahl = 0;
    for (int i=0;i&lt;Text.Lenght();i++)
    {
//.........
    }
    return anzahl;
}
//---------------------------------------------------------------------------
</code></pre>
<p>Kann mir da jemand helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1124591</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1124591</guid><dc:creator><![CDATA[needle]]></dc:creator><pubDate>Fri, 25 Aug 2006 16:53:48 GMT</pubDate></item><item><title><![CDATA[Reply to Gibt es substr_count in CBuilder? on Fri, 25 Aug 2006 17:06:19 GMT]]></title><description><![CDATA[<p>Es gibt die Funktion</p>
<pre><code class="language-cpp">int __fastcall Pos(const AnsiString&amp; subStr) const;
</code></pre>
<p>Sowas wäre eine Möglichkeit:</p>
<pre><code class="language-cpp">AnsiString test=&quot;Hello world, hello sunshine, hello was weiß ich&quot;;
AnsiString such_string=&quot;el&quot;;
int anzahl=0;
AnsiString proc=test;

while(proc.Pos(such_string)!=0)
{ 
 proc=proc.Delete(proc.Pos(such_string),such_string.Length()); 
 anzahl++;
}

Edit1-&gt;Text=IntToStr(anzahl);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1124599</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1124599</guid><dc:creator><![CDATA[rean]]></dc:creator><pubDate>Fri, 25 Aug 2006 17:06:19 GMT</pubDate></item><item><title><![CDATA[Reply to Gibt es substr_count in CBuilder? on Fri, 25 Aug 2006 17:19:04 GMT]]></title><description><![CDATA[<p>Cool! Danke <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
<p>Falls noch Andere, andere Variante haben, würde ich die gerne auch sehen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1124616</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1124616</guid><dc:creator><![CDATA[needle]]></dc:creator><pubDate>Fri, 25 Aug 2006 17:19:04 GMT</pubDate></item><item><title><![CDATA[Reply to Gibt es substr_count in CBuilder? on Mon, 28 Aug 2006 08:34:21 GMT]]></title><description><![CDATA[<p>Mit Standard-Strings geht es etwas kürzer und ohne Löschen</p>
<pre><code class="language-cpp">std::string text = &quot;Hello world, hello sunshine, hello was weiss ich&quot;;
std::string such = &quot;el&quot;;
int pos = -1;
size_t anzahl(0);
while( (pos = text.find(such, pos+1)) != string::npos) ++anzahl;
Edit1-&gt;Text = IntToStr(anzahl);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1125920</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1125920</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Mon, 28 Aug 2006 08:34:21 GMT</pubDate></item></channel></rss>