Strip whitespace from a string/Top and tail: Difference between revisions
Strip whitespace from a string/Top and tail (view source)
Revision as of 18:53, 9 May 2022
, 2 years ago→{{header|Picat}}
m (→{{header|Phix}}: retracted the 4 spaces thing... will revisit) |
|||
Line 2,056:
^ this is a string$
</pre>
=={{header|Picat}}==
Using the built-in functions lstrip/1, rstrip/1, strip/1, and strip/2.
<lang Picat>import util.
go =>
S = " Jabberwocky ",
println("<" ++ S ++ ">"),
println("<" ++ lstrip(S) ++ ">"),
println("<" ++ rstrip(S) ++ ">"),
println("<" ++ strip(S) ++ ">"),
println("<" ++ strip("\t\r\bTwas brillig, and the slithy toves\r \t\v"," \b\v\t\r\v") ++ ">"),
nl.</lang>
{{out}}
<pre>< Jabberwocky >
<Jabberwocky >
< Jabberwocky>
<Jabberwocky>
<Twas brillig, and the slithy toves></pre>
=={{header|PicoLisp}}==
|