RosettaCodeData/Task/Substring-Top-and-tail/Sidef/substring-top-and-tail-2.sidef

5 lines
242 B
Text
Raw Permalink Normal View History

2016-12-05 23:44:36 +01:00
var gstr = "J\x{332}o\x{332}s\x{332}e\x{301}\x{332}";
say gstr-/^\X/; # strip first grapheme
say gstr-/\X\z/; # strip last grapheme
say gstr.sub(/^\X/).sub(/\X\z/); # strip both first and last graphemes