index
# given 'unexplainable'
$string->index('explain'); # 2
$string->index('explain', 0); # 2
$string->index('explain', 1); # 2
$string->index('explain', 2); # 2
$string->index('explain', 3); # -1
$string->index('explained'); # -1
The index method searches for the argument within the string and returns the position of the first occurrence of the argument. This method optionally takes a second argument which would be the position within the string to start searching from (also known as the base). By default, starts searching from the beginning of the string. This method returns a data type object to be determined after execution.
index(Str $arg1, Num $arg2) : NumObject
method
5 POD Errors
The following errors were encountered while parsing the POD:
- Around line 10:
Unknown directive: =name
- Around line 14:
Unknown directive: =usage
- Around line 25:
Unknown directive: =description
- Around line 34:
Unknown directive: =signature
- Around line 38:
Unknown directive: =type