Logo

Programming-Idioms

History of Idiom 38 > diff from v1 to v2

Edit summary for version 2 by :

Version 1

2015-05-06, 21:04:50

Version 2

2015-07-31, 19:34:36

Idiom #38 Extract a substring

Find substring t consisting in characters i (included) to j (excluded) of string s.
(character indexes start at 0 unless specified otherwise)

Idiom #38 Extract a substring

Find substring t consisting in characters i (included) to j (excluded) of string s.
(character indexes start at 0 unless specified otherwise)

Code
my $chunk = substr("now is the time", 3, 4);
Comments bubble
Get four characters starting at position 3 (the fourth character, since perl is 0-based).