Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

IndexOf: Difference between revisions

From Catglobe Wiki
Cg van (talk | contribs)
No edit summary
No edit summary
 
Line 21: Line 21:
'''Example'''  
'''Example'''  


''string s1 = "is"; ''
''number result =indexOf("is", "catglobe is tHe beSt"); ''
 
''string s2 = "catglobe is tHe beSt"; ''
 
''number result =indexOf(s1, s2); ''


''print(result); ''
''print(result); ''

Latest revision as of 04: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

Contents