1 # Copyright (C) 2007-2009, Parrot Foundation.
4 =head1 String Operations (continued)
6 We can pick apart a string and pull substrings out of it using the
7 C<substr> command. C<substr> takes a string, a starting position and
8 optionally an ending position. It returns all the characters in
9 the string between the starting and ending positions. If the ending
10 position is left out, C<substr> returns all the characters until the
13 An optional fourth argument is a string that will be used to
14 replace the characters between the start and end positions.
20 $S0 = substr "abcde", 1, 2 # "bc"
24 $S0 = substr $S1, 1, 2
29 $S0 = substr $S1, 1, 2, "XYZ"
39 # vim: expandtab shiftwidth=4 ft=pir: