Whitespace removal: trim, rtrim, ltrim
Syntax
{ trim | ltrim | rtrim }¹ ( op )
Input parameters
op |
the operand |
Semantics for scalar operations
Removes trailing or/and leading whitespace from a string.
For example, trim("Hello ")
gives "Hello"
.
Input parameters type
op1
dataset { measure<string> _+ }
| component<string>
| string
Result type
result
dataset { measure<string> _+ }
| component<string>
| string
Additional Constraints
None.
Behavior
The operator has the behaviour of the “Operators applicable on one Scalar Value or Data Set or Data Set Component” (see the section “Typical behaviours of the ML Operators”).
Examples
Given the operand dataset DS_1 (note that the input data have a whitesapce at the end of the string, which may not be visualised):
Input DS_1 (see structure)
Id_1 |
Id_2 |
Me_1 |
---|---|---|
1 |
A |
hello |
2 |
B |
hi |
Example 1
DS_r := rtrim(DS_1);
results in (see structure):
Id_1 |
Id_2 |
Me_1 |
---|---|---|
1 |
A |
hello |
2 |
B |
hi |
Example 2
DS_r := DS_1[ calc Me_2:= rtrim(Me_1)];
results in (see structure):
Id_1 |
Id_2 |
Me_1 |
Me_2 |
---|---|---|---|
1 |
A |
hello |
hello |
2 |
B |
hi |
hi |