We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8fccc13 commit 1da21e2Copy full SHA for 1da21e2
pod/perlfunc.pod
@@ -3585,6 +3585,20 @@ respectively. POSITION and the return value are based at zero.
3585
If the substring is not found, L<C<index>|/index STR,SUBSTR,POSITION>
3586
returns -1.
3587
3588
+Find characters or strings:
3589
+
3590
+ index("Perl is great", "P"); # Returns 0
3591
+ index("Perl is great", "g"); # Returns 8
3592
+ index("Perl is great", "great"); # Also returns 8
3593
3594
+Attempting to find something not there:
3595
3596
+ index("Perl is great", "Z"); # Returns -1 (not found)
3597
3598
+Using an offset to find the I<second> occurrence:
3599
3600
+ index("Perl is great", "e", 5); # Returns 10
3601
3602
=item int EXPR
3603
X<int> X<integer> X<truncate> X<trunc> X<floor>
3604
0 commit comments