Substring/Top and tail: Difference between revisions

GP
({{header|AWK}})
(GP)
Line 42:
alert("socks".slice(0, -1)); // strip last character
alert("brooms".slice(1, -1)); // strip both first and last characters</lang>
 
=={{header|PARI/GP}}==
<lang parigp>df(s)=concat(vecextract(Vec(s),1<<#s-2));
dl(s)=concat(vecextract(Vec(s),1<<(#s-1)-1));
db(s)=concat(vecextract(Vec(s),1<<(#s-1)-2));</lang>
 
=={{header|Perl}}==