Substring/Top and tail: Difference between revisions

Content added Content deleted
(Substring/Top and tail in Dart)
Line 324: Line 324:
brooms: "brooms"
brooms: "brooms"


print drop knight 1 ; strip first character
print drop knight. ; strip first character
print slice knight 1 (size knight)-1 ; alternate way to strip first character
print slice knight 1 (size knight)-1 ; alternate way to strip first character


Line 331: Line 331:
print slice socks 0 (size socks)-2 ; yet another way to strip last character
print slice socks 0 (size socks)-2 ; yet another way to strip last character


print chop drop brooms 1 ; strip both first and last characters
print chop drop brooms ; strip both first and last characters
print slice brooms 1 (size brooms)-2 ; alternate way to strip both first and last characters</syntaxhighlight>
print slice brooms 1 (size brooms)-2 ; alternate way to strip both first and last characters</syntaxhighlight>