Substring/Top and tail: Difference between revisions

Add XPL0
No edit summary
(Add XPL0)
Line 748:
string s_first_last = s[1:s.length - 1];
</lang>
 
=={{header|XPL0}}==
<lang XPL0>include c:\cxpl\stdlib;
char S, P;
[S:= "Smiles";
Text(0, S+1); \first character removed
CrLf(0);
P:= S + StrLen(S) - 2; \point to last character in string
P(0):= P(0) ! $80; \set the MSb on the last character
Text(0, S); \last character removed
CrLf(0);
Text(0, S+1); \first and last characters removed
CrLf(0);
]</lang>
 
Output:
<pre>
miles
Smile
mile
</pre>
 
=={{header|ZX Spectrum Basic}}==
772

edits