NInStr
Count = NInStr ( String AS String , Substring AS String [ , Comparison AS Integer ] )
Returns the number of occurrences of a substring.
Arguments
-
String : The string to look into.
-
Substring: The substring to search.
-
Comparison: The comparison algorithm to use.
Return value
Return the number of occurrences, or zero if no occurrence is found.
Description
This function returns the number of occurrences of
Substring inside
String.
Comparison can be one of the following value:
If
Comparison is not specified, then a binary comparison is done.
This function only deals with ASCII strings. To manipulate UTF-8 strings, use the
String class.
Examples
PRINT NInstr("Gambas Almost Means BASIC", "a")
PRINT NInstr("Gambas Almost Means BASIC", "A")
PRINT NInstr("Gambas Almost Means BASIC", "a", gb.IgnoreCase)
PRINT NInstr("Gambas Almost Means BASIC", "Bas", gb.IgnoreCase)
See also