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


GML Code Example

string_count(substr, str);

Argument Description
substr The substring to check the string for.
str The string to check.

Returns: Real


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.


GML Code Example

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

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

Back: Strings

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here