Difference between revisions of "IndexOf"
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | {{HelpFiles}} | |
− | ==== indexOf ==== | + | ==== indexOf ==== |
Returns a 0-based index of the first occurrence of a string in another string. Returns empty if there are no occurrences found. | Returns a 0-based index of the first occurrence of a string in another string. Returns empty if there are no occurrences found. | ||
Line 21: | Line 21: | ||
'''Example''' | '''Example''' | ||
− | + | ''number result =indexOf("is", "catglobe is tHe beSt"); '' | |
− | + | ''print(result); '' | |
− | + | ''//9 '' | |
− | |||
− | |||
− | |||
− | //9 | ||
'''Availability''' | '''Availability''' | ||
− | Version 5.2 | + | Version 5.2 |
[[Category:String_Functions]] | [[Category:String_Functions]] |
Latest revision as of 05:21, 14 August 2024
indexOf
Returns a 0-based index of the first occurrence of a string in another string. Returns empty if there are no occurrences found.
Syntax
indexOf(stringToSearchFor, stringToSearchIn)
Arguments
stringToSearchFor: is a string expression.
stringToSearchIn: is a string expression.
Return type
number
Example
number result =indexOf("is", "catglobe is tHe beSt");
print(result);
//9
Availability
Version 5.2