Difference between revisions of "IndexOf"
Line 1: | Line 1: | ||
− | + | | |
− | + | ||
+ | ==== 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''' | |
− | + | string 1 = "is"; | |
− | string | + | string s2 = "catglobe is tHe beSt"; |
− | + | number result =indexOf(s1, s2); | |
− | + | print(result); | |
− | + | //9 | |
− | + | '''Availability''' | |
− | + | Version 5.2 | |
− | + | [[Category:String_Functions]] | |
− | |||
− |
Revision as of 04:28, 14 December 2011
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
string 1 = "is";
string s2 = "catglobe is tHe beSt";
number result =indexOf(s1, s2);
print(result);
//9
Availability
Version 5.2