Onetastic Macro Documentation >
>
>
String_FindFirst String_FindFirst
Finds the first occurence of a search string in an input string. Returns true if the string was found and the offset it was found at, false otherwise.
Syntax
Bool String_FindFirst(
String string,
String search,
Numeric offset,
Bool ignorecase,
out Numeric foundAt)
Parameters
- String string
- String to search in.
- String search
- The substring to search for.
- Numeric offset
- Offset of the input string to start search from. If non-negative, search will start this number of characters counted from the beginning of the string. If negative, the search will start this number of characters counted from the end of the string.
- Bool ignorecase
- Ignores the case of the strings if set to true.
- out Numeric foundAt
- If the search string is found, the offset of the first occurence is stored in this variable.
Examples
$string = "a4 b6 c5 4a b6 d5 f6 d7 e4 b6 c2 56 d4 5a"
String_FindFirst($string, "b6", 0, false, $foundAt)
String_FindFirst($string, "b6", 9, false, $foundAt)
String_FindFirst($string, "b6", -20, false, $foundAt)
String_FindFirst($string, "f9", 0, false, $foundAt)
String_FindFirst("The quick brown fox jumps over the lazy dog", "the", 0, false, $foundAt)
String_FindFirst("The quick brown fox jumps over the lazy dog", "the", 0, true, $foundAt)
|