Count occurrences of a substring: Difference between revisions
no edit summary
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
No edit summary |
||
Line 1,417:
In '''[https://formulae.org/?example=Count_occurrences_of_a_substring this]''' page you can see the program(s) related to this task and their results.
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">window 1
local fn CountSubstring( string as CFStringRef, substring as CFStringRef ) as long
end fn = fn ArrayCount( fn StringComponentsSeparatedByString( string, substring ) ) - 1
print fn CountSubstring( @"the three truths", @"th" )
print fn CountSubstring( @"ababababab", @"abab" )
HandleEvents</syntaxhighlight>
{{out}}
<pre>3
2
</pre>
=={{header|Go}}==
|