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

m
→‎{{header|Wren}}: Changed to Wren S/H
No edit summary
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(3 intermediate revisions by one other user not shown)
Line 222:
)</syntaxhighlight>
 
=={{header|Amazing Hopper!}}==
 
<p>Amazing Hopper! Flavour "Jambo".</p>
<syntaxhighlight lang="amazing_hopperAmazing Hopper">
#include <jambo.h>
 
Line 654 ⟶ 653:
return 0;
}</syntaxhighlight>
 
==={{header|Gadget}}===
 
<p>Gadget C-library:
[https://github.com/DanielStuardo/Gadget Gadget C-library in Github]
</p>
<syntaxhighlight lang="c">
#include <gadget/gadget.h>
 
LIB_GADGET_START
 
Main
String r,s,t;
Stack{
Store ( r, Trim_r (Upper(" \n\t este mensaje será modificado " )) )
Store ( s, Trim_l (Reverse(Upper(" \n\t este mensaje será odasrever " ))) )
Store ( t, Trim (Upper(" \n\t este mensaje será modificado " )) )
}Stack_off
Print "Right Trim = [%s]\nLeft Trim = [%s]\nAll Trim = [%s]\n",r,s,t;
 
Free secure r,t, s;
End
</syntaxhighlight>
{{out}}
<pre>
Right Trim = [
ESTE MENSAJE SERÁ MODIFICADO]
Left Trim = [REVERSADO ÁRES EJASNEM ETSE
]
All Trim = [ESTE MENSAJE SERÁ MODIFICADO]
 
</pre>
 
=={{header|C sharp|C#}}==
Line 3,175 ⟶ 3,207:
=={{header|Wren}}==
In Wren 'whitespace' is defined as: space, tab, carriage return, and line feed characters. To trim off other non-printing characters such as form feed and vertical tab, you need to do a little more work.
<syntaxhighlight lang="ecmascriptwren">var a = " \t\r\nString with leading whitespace removed"
var b = "String with trailing whitespace removed \t\r\n"
var c = " \t\r\nString with both leading and trailing whitespace removed \t\r\n"
9,482

edits