String
String transforms operate on string data.
string.append
Appends (suffixes) a substring to string data.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Sets a value into an object after transformation. | No |
suffix | string | String value that is appended to the data. | Yes |
Example
sub.transform.string.append(
settings={object: {source_key: 'str', target_key: 'str'}, suffix: '\n'}
)
sub.tf.str.append({obj: {src: 'str', trg: 'str'}, suffix: '\n'})
string.capture
Captures one or more substrings using a regular expression pattern. This transform can produce a single capture (as a string), many captures (as an array), and an object (using a named capture group).
If configured to capture more than one substring, then the result is a JSON array, otherwise the result is a string.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
pattern | string | Regular expression pattern used to capture substrings. | Yes |
count | integer | Number of captures to make. If configured, then the result is a JSON array. Defaults to 0. | No |
Example
sub.transform.string.capture(
settings={object: {source_key: 'str', target_key: 'str'}, pattern: '^(.*)$'}
)
sub.tf.str.match.find({obj: {src: 'str', trg: 'str'}, pattern: '^(.*)$'})
string.replace
Replaces characters in string data.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
pattern | string | Regular expression pattern used to identify values to replace. | Yes |
replacement | string | String value that replaces the matched data. | Yes |
Example
sub.transform.string.replace(
settings={object: {source_key: 'str', target_key: 'str'}, pattern: 'c', replacement: 'b'}
)
sub.tf.str.replace({obj: {src: 'str', trg: 'str'}, pattern: 'c', replacement: 'b'})
string.split
Splits a string into a JSON array.
This is the opposite of the Array transform array_join
.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
separator | string | Separator substring that is used to split values. | Yes |
Example
sub.transform.string.split(
settings={object: {source_key: 'str', target_key: 'str'}, separator: '.'}
)
sub.tf.str.split({obj: {src: 'str', trg: 'str'}, separator: '.'})
string.to.lower
Converts a string to lowercase (downcase).
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
Example
sub.transform.string.to.lower(
settings={object: {source_key: 'str', target_key: 'str'}}
)
sub.tf.str.to.lower({obj: {src: 'str', trg: 'str'}})
string.to.upper
Converts a string to uppercase (upcase).
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
Example
sub.transform.string.to.upper(
settings={object: {source_key: 'str', target_key: 'str'}}
)
sub.tf.str.to.upper({obj: {src: 'str', trg: 'str'}})
string.to.snake
Converts a string to snake case.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.source_key | string | Retrieves a value from an object for transformation. | No |
object.target_key | string | Places a value into an object after transformation. | No |
Example
sub.transform.string.to.snake(
settings={object: {source_key: 'str', target_key: 'str'}}
)
sub.tf.str.to.snake({obj: {src: 'str', trg: 'str'}})
string.uuid
Generates a UUIDv4 string.
Settings
Field | Type | Description | Required |
---|---|---|---|
object.target_key | string | Places a value into an object after transformation. | No |
Example
sub.transform.string.uuid(
settings={object: {target_key: 'uuid'}}
)
sub.tf.str.uuid({obj: {trg: 'uuid'}})
Updated 10 months ago