Substring/Top and tail: Difference between revisions

({{header|Lua}})
Line 6:
* String with both the first and last characters removed
 
=={{header|ALGOL 68}}==
{{trans|AWK}}
{{works with|ALGOL 68|Revision 1 - no extensions to language used.}}
{{works with|ALGOL 68G|Any - tested with release [http://sourceforge.net/projects/algol68/files/algol68g/algol68g-1.18.0/algol68g-1.18.0-9h.tiny.el5.centos.fc11.i386.rpm/download 1.18.0-9h.tiny].}}
{{wont work with|ELLA ALGOL 68|Any (with appropriate job cards) - tested with release [http://sourceforge.net/projects/algol68/files/algol68toc/algol68toc-1.8.8d/algol68toc-1.8-8d.fc9.i386.rpm/download 1.8-8d] - due to extensive use of '''format'''[ted] ''transput''.}}
<lang algol68>#!/usr/local/bin/a68g --script #
 
STRING my string="knight";
printf(($gl$,
my string[2:], # remove the first letter #
my string[ :UPB my string-1], # remove the last character #
my string[2:UPB my string-1] # remove both the first and last character #
))</lang>
Output:
<pre>
night
knigh
nigh
</pre>
=={{header|AWK}}==