Strings cut
DescriptionThe Strings Cut transform cuts a portion of a string (i.e., a substring). If the designated field is out of range, it returns blank. |
Supported Engines
|
Options
| Option | Description |
|---|---|
Transform name |
Name of the transform. |
In stream field |
Name of the field whose substring to cut. |
Out stream field |
When a field name is given here, the transform creates a new field with the substring. Otherwise the original field gets replaced by the substring. |
Cut from |
Designate where to begin cutting the substring. This value is 0-based, thus the first character in a string is 0. |
Cut to |
Designate where to end cutting the substring. This value is exclusive (1-based), so using a 1 includes the first character. The maximum length of the new string is Cut to minus Cut from. |
Examples
Consider the following string (displayed here with positive and negative length references):
|0 |10 |20 |30 |40 The quick brown fox jumps over the lazy dog |-40 |-30 |-20 |-10
The text above is considered as input string in all the following examples:
| Cut from | Cut to | Result | Notes |
|---|---|---|---|
0 |
9 |
|
Use |
10 |
19 |
|
Use two positive indexes to get a substring from the start of the input |
0 |
-12 |
|
Use a negative index to get a substring from the end of the input |
-13 |
-23 |
|
Use two negative indexes to get a substring from the end of the input |
20 |
10 |
(null) |
When the first index is lower than the second, |
10 |
10 |
(empty string) |
When the two indexes are equal, an empty string (not |
20 |
100 |
|
When the second index is greater than the input length, the returned substring extends to the end of the input |
50 |
100 |
(null) |
When the first index is greater than the input length, |
10 |
-10 |
|
When the two indexes have different signs, the entire input is returned |