Strip whitespace from a string/Top and tail: Difference between revisions

Changed output. Added output.
m (→‎{{header|Phix}}: added syntax colouring the hard way, phix/basics)
(Changed output. Added output.)
Line 1,661:
<lang nim>import strutils
 
let s = " \t \nv \r String with spaces \n \t \n f"
echo "'", s, "'"
echo("*** Stripped of leading spaces ***")
echo "'", s.strip(trailing = false), "'"
echo "'", s.strip(leadingtrailing = false), "'"
echo("*** Stripped of trailing spaces ***")
echo "'", s.strip(), "'"</lang>
echo "'", s.strip(trailingleading = false), "'"
echo("*** Stripped of leading and trailing spaces ***")
echo "'", s.strip(), "'"</lang>
</lang>
 
{{out}}
<pre>“
String with spaces
*** Stripped of leading spaces ***
“String with spaces
*** Stripped of trailing spaces ***
String with spaces”
*** Stripped of leading and trailing spaces ***
“String with spaces”</pre>
 
=={{header|Oberon-2}}==
Anonymous user