Substring/Top and tail: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) (added Arturo) |
(add Scheme) |
||
Line 1,726: | Line 1,726: | ||
println("socks".init) // strip last character |
println("socks".init) // strip last character |
||
println("brooms".tail.init) // strip both first and last characters</lang> |
println("brooms".tail.init) // strip both first and last characters</lang> |
||
=={{header|Scheme}}== |
|||
<lang scheme>(define (string-top s) |
|||
(if (string=? s "") s (substring s 0 (- (string-length s) 1)))) |
|||
(define (string-tail s) |
|||
(if (string=? s "") s (substring s 1 (string-length s)))) |
|||
(define (string-top-tail s) |
|||
(string-tail (string-top s)))</lang> |
|||
=={{header|Seed7}}== |
=={{header|Seed7}}== |