Substring/Top and tail: Difference between revisions

Content added Content deleted
({{header|AWK}})
Line 5: Line 5:
* String with last character removed
* String with last character removed
* String with both the first and last characters removed
* String with both the first and last characters removed

=={{header|AWK}}==

<lang awk>BEGIN {
mystring="knight"
print substr(mystring,2) # remove the first letter
print substr(mystring,1,length(mystring)-1) # remove the last character
print substr(mystring,2,length(mystring)-1) # remove both the first and last character
}</lang>


=={{header|Icon}} and {{header|Unicon}}==
=={{header|Icon}} and {{header|Unicon}}==