Jump to content

Substring/Top and tail: Difference between revisions

{{header|Lua}}
(GP)
({{header|Lua}})
Line 42:
alert("socks".slice(0, -1)); // strip last character
alert("brooms".slice(1, -1)); // strip both first and last characters</lang>
 
=={{header|Lua}}==
 
<lang lua>print (string.sub("knights",2)) -- remove the first character
print (string.sub("knights",1,-2)) -- remove the last character
print (string.sub("knights",2,-2)) -- remove the first and last characters</lang>
 
=={{header|PARI/GP}}==
Cookies help us deliver our services. By using our services, you agree to our use of cookies.