Substring/Top and tail: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: added syntax colouring the hard way, phix/basics)
(Changed output. Avoided to use negatives indexes in "runeSubstr" as this may not work (bug in V1.4).)
Line 1,219: Line 1,219:


let s = "Hänsel ««: 10,00€"
let s = "Hänsel ««: 10,00€"
echo "Original: ", s
echo(s.runeSubStr(1))
echo(s.runeSubStr(0, -1))
echo "With first character removed: ", s.runeSubStr(1)
echo(s.runeSubStr(1, -1))
echo "With last character removed: ", s.runeSubStr(0, s.runeLen - 1)
echo "With first and last characters removed: ", s.runeSubStr(1, s.runeLen - 2)
# using the runes type and slices
# Using the runes type and slices
let r = s.toRunes
let r = s.toRunes
echo(r[1 .. ^2])</lang>
echo "With first and last characters removed (other way): ", r[1 .. ^2]</lang>
{{out}}
{{out}}
<pre>änsel ««: 10,00€
<pre>Original: Hänsel ««: 10,00€
Hänsel ««: 10,00
With first character removed: änsel ««: 10,00€
änsel ««: 10,00
With last character removed: Hänsel ««: 10,00
änsel ««: 10,00</pre>
With first and last characters removed: änsel ««: 10,00
With first and last characters removed (other way): änsel ««: 10,00</pre>


=={{header|Objeck}}==
=={{header|Objeck}}==