NInStr

Count = NInStr ( String AS String , Substring AS String [ , Comparison AS Integer ] )

Since 3.21

Returns the number of occurrences of Substring inside String.

Comparison can be one of the following value: If the substring is not found, this function returns zero.

This function only deals with ASCII strings. To manipulate UTF-8 strings, use the String class.

Examples

PRINT NInstr("Gambas Almost Means BASIC", "a")
3

PRINT NInstr("Gambas Almost Means BASIC", "A")
2

PRINT NInstr("Gambas Almost Means BASIC", "a", gb.IgnoreCase)
5

PRINT NInstr("Gambas Almost Means BASIC", "Bas", gb.IgnoreCase)
2

See also