Substring/Top and tail: Difference between revisions

Content added Content deleted
(promoted to task)
Line 41: Line 41:


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