# New Ticket Created by Colin Kuskie
# Please include the string: [perl #44515]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=44515 >
Add POD and more example code to the substr PIR tutorial example.
Index: examples/tutorial/23_string_ops_substr.pir
===================================================================
--- examples/tutorial/23_string_ops_substr.pir (revision 20571)
+++ examples/tutorial/23_string_ops_substr.pir (working copy)
@@ -1,3 +1,13 @@
+=head1 String Operations (continued)
+
+C<substr> selects the requested number of characters starting at
+the offset. If the requested number of characters is left out,
+then all characters to the end of the string are removed.
+An optional fourth argument may be a string that will replace the
+selected characters.
+
+=cut
+
.sub main :main
$S0 = substr "abcde", 1, 2 # "bc"
@@ -4,6 +14,11 @@
say $S0
set $S1, "abcde"
+ $S0 = substr $S1, 1, 2
+ say $S0 # "bc"
+ say $S1 # "abcde"
+
+ set $S1, "abcde"
$S0 = substr $S1, 1, 2, "XYZ"
say $S0 # "bc"
say $S1 # "aXYZde"