Trim
Synopsis
Removes leading and trailing whitespace from string values.
Schema
trim:
- field: <ident>
- description: <text>
- if: <script>
- ignore_failure: <boolean>
- ignore_missing: <boolean>
- on_failure: <processor[]>
- on_success: <processor[]>
- tag: <string>
- target_field: <ident>
Configuration
Field | Required | Default | Description |
---|---|---|---|
field | Y | - | Field containing string(s) to trim |
description | N | - | Explanatory note |
if | N | - | Condition to run |
ignore_failure | N | false | See Handling Failures |
ignore_missing | N | false | If true , quietly exit if field doesn't exist |
on_failure | N | - | See Handling Failures |
on_success | N | - | See Handling Success |
tag | N | - | Identifier |
target_field | N | field | Field to store the trimmed value(s) |
Details
The processor can handle both single string fields and arrays of strings. When processing an array, it trims each element.
warning
If the field contains non-string values, the processor will fail unless ignore_failure
is set to true
.
note
The processor only removes whitespace characters (spaces, tabs, and new lines) from the beginning and end of strings. It does not affect whitespace between words.
Examples
Single String
Trimming the username... |
|
removes the leading and trailing spaces: |
|
String Arrays
Trimming an array of email addresses... |
|
removes leading and trailing spaces from each: |
|
Target Field
Storing the trimmed values in a new field... |
|
preserves the original: |
|