Related Links
To return the first position of appearance of the match in the string
With this function, you can determine the position of a searched string within a given text. The search string can be a single character or a longer string.
Unlike contains(), this function not only checks whether the searched string exists but also determines the numeric value of its start position within the text. Counting starts at 0.
Only if the searched string exactly matches the existing text, the position will be returned.
If the searched string is not found, the result is -1.
If the searched match is an empty string, the result will be 0.
If you don't want to distinguish between upper and lower case letters, we recommend that you unify either the specified text or the searched string with the functions lower() or upper().


index(string, string)




index(string, match)Determines the first position of a given match in a given string, starting with 0.
index("Ninox is great!", "ox")
Result: 3
index("Ninox is great!", "N")
Result: 0
index("Ninox is great!", "oX")
Result: -1 (no exact match found)

See also

contains, which checks if a given string contains the exact given match.
Last modified 2mo ago
Export as PDF
Copy link