Text trim whitespaces
This block is used to remove spaces around the source string.
Removing modes:
- both sides: remove spaces from both sides of the string,
- left side: remove spaces from left side of the string,
- right side: remove spaces from right side of the string.
Right part defines the source string. This argument is required. The output of the block is a string value with removed spaces.
In case the supplied string variable is not actually string, it returns None.
XML representation of the text_trim block
<xml xmlns="http://www.w3.org/1999/xhtml">
<block type="text_trim">
<field name="MODE">BOTH</field>
<value name="TEXT">
<block type="text">
<field name="TEXT">input_string</field>
</block>
</value>
</block>
<block type="text_trim">
<field name="MODE">LEFT</field>
<value name="TEXT">
<block type="variables_get">
<field name="VAR">input_var</field>
</block>
</value>
</block>
<block type="text_trim">
<field name="MODE">RIGHT</field>
<value name="TEXT">
<block type="variables_get">
<field name="VAR">input_var</field>
</block>
</value>
</block>
</xml>

Block “Trim spaces from”

Example of “Trim spaces from” block
Block is used twice in the example:
- “Set user_trim to … both sides” row: remove spaces from both sides of string " username “. Output is value “username” without spaces.
- “Set user_trim to … right side” row: remove spaces from right side of string " username “. Output is value " username” without space in the right side of string.

Results of “Trim spaces from” block