TextManipulation icon

TextManipulation

Allows you to manipulate string values.

TextManipulation

AI-generated

Summary

Manipulates string values from text sources applying configured actions, then writes results to JSON or binary output.

Inputs

  • keepOnlySet — When true, discards existing item json and binary before processing; only values set on this node are kept.
  • textsWithManipulations (required) — Fixed collection of groups; each group defines a text source and one or more manipulation actions to apply in order.
  • dataSources (required) — Nested fixed collection within textsWithManipulations; specifies how to read the text: fromText (direct string), fromFile (binary property decoded with iconv), or fromJSON (value at sourceKey from item json).
  • writeOperation (required) — Fixed option; 'toJSON' writes the manipulated text to a JSON key via destinationKey. 'toFile' encodes the text to binary and writes to a binary property.
  • destinationKey (required) — JSON key to write manipulated text to; required when writeOperation is 'toJSON'. Deep keys via dot-notation are supported.
  • destinationBinaryPropertyName (required) — Binary property name to write encoded data to; required when writeOperation is 'toFile'.

Output shape

Each input item is returned with updated json and/or binary. json contains the manipulated text at destinationKey when writeOperation is 'toJSON'. binary contains the encoded file data when writeOperation is 'toFile'. If keepOnlySet is true, existing item data is discarded before processing.

Text is read per data source group, manipulation actions are applied sequentially (concat, decodeEncode, decodeEncodeEntities, letterCase, normalize, pad, repeat, replace, substring, trim), then output is written. Available manipulation actions and key sub-parameters: concat (before/after strings), decodeEncode (iconv decode/encode with addBOM/stripBOM), decodeEncodeEntities (HTML/URL/XML decode/encode with modes and encode settings), letterCase (camelCase, capitalize, kebabCase, snakeCase, startCase, upperCase, lowerCase, localeUpperCase/localeLowerCase with language), normalize (NFC/NFD/NFKC/NFKD), pad (padStart/padEnd with targetLength and padString), repeat (times), replace (substring/extendedSubstring/regex/predefinedRule with value, replaceAll, extended, predefinedRule options: tags/characterGroups), substring (startPosition, end: complete/position/length with endPosition/endLength), trim (trimBoth/trimStart/trimEnd with trimString and trimStringUnit), and encode/ decodeWith/encodeWith options for binary encoding/decoding.

Examples

Example 1: Capitalize first letter of text from JSON and write to a new key

keepOnlySet: false; textsWithManipulations.dataSources.readOperation: fromJSON; sourceKey: 'name'; manipulations.action: letterCase; caseType: capitalize; writeOperation: toJSON; destinationKey: 'capitalizedName'

Example 2: Read binary file, strip BOM, convert encoding, and write to a new file

keepOnlySet: false; textsWithManipulations.dataSources.readOperation: fromFile; binaryPropertyName: 'attachment'; fileDecodeWith: utf8; fileStripBOM: true; manipulations.action: decodeEncode; decodeWith: utf8; encodeWith: base64; writeOperation: toFile; destinationBinaryPropertyName: 'output'; fileName: 'result.txt'; fileEncodeWith: base64; fileAddBOM: false

Links

Discussion