Skip to content

string_count

CryoEagle edited this page Dec 26, 2018 · 4 revisions

string_count

Returns the number of instances of a substring found within a given string.

Syntax:

string_count(substr, str)
Argument Description
string substr The substring to check the string for
string str The string to check

Returns: Real

Description

This function will return the amount of times the given substring appears within a specific string. In this way you can check for how many times a single letter or a phrase is repeated in a section of stored text.

Example:

string str1 = "Hello World";
int ocount = string_count( "o", str1 ); 

This will set ocount to the number of "o"s in str1, in this case 2.

Back to strings

Clone this wiki locally