Mwnci index() Function

Syntax

index(data,search)

Description

The index() function returns the position (indicated as an integer) in a string or array at which search string begins, or -1 if string does not occur in the string or array. The first position is 0.

Example

a="this is a string" 
b=["this", "is", "an", "array"]
println(index(a, "str"))
println(index(b, "an"))


10
2