Jump to content

Substring/Top and tail: Difference between revisions

m
Line 13:
<lang algol68>#!/usr/local/bin/a68g --script #
 
STRING my stringstr="knightcarousers";
printf(($gl$,
my string[2:]str, # remove the firstno lettercharacters #
my stringstr[LWB str+1:UPB my string-1 ], # remove the lastfirst character #
my stringstr[2 :UPB my stringstr-1] , # remove both the first and last character #
str[LWB str+1:UPB str-1], # remove both the first and last character #
str[LWB str+2: ], # remove the first 2 characters #
str[ :UPB str-2], # remove the last 2 characters #
str[LWB str+2:UPB str-2] # remove both the first and last 2 characters #
))</lang>
Output:
<pre>
carousers
night
arousers
knigh
carouser
nigh
arouser
rousers
carouse
rouse
</pre>
 
=={{header|AWK}}==
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.