FindString()
Syntax
Position = FindString(String$, StringToFind$ [, StartPosition [, Mode]])Description
Find the 'StringToFind$' within the given 'String$'.
Parameters
String$ The string to use. StringToFind$ The string to find. StartPosition (optional) The start position to begin the search. The first valid character index is 1. If this parameter isn't specified, the whole string is searched. Mode (optional) It can be one of the following values: #PB_String_CaseSensitive: case sensitive search (a=a) (default). #PB_String_NoCase : case insensitive search (A=a).
Return value
Returns the position (in character) of the string to find, or zero is the string isn't found. The first character index is 1.Debug FindString("PureBasic", "Bas") ; will display 5
Example
String$ = "This is a simple line...." Repeat Last = Position Position = FindString(String$ , "i", Position + 1) If Position > 0 Debug "'i' found at position: " + Position EndIf Until Not Position Debug "Last position 'i' was found: " + Last
Supported OS
All