Strip whitespace from a string/Top and tail: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: retracted the 4 spaces thing... will revisit) |
|||
Line 2,056: | Line 2,056: | ||
^ this is a string$ |
^ this is a string$ |
||
</pre> |
</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}}== |
=={{header|PicoLisp}}== |