Skip to content

String Operations

Text manipulation: case conversion, split, pad, slugify, template, and more.

11 modules

ModuleDescription
String LowercaseConvert a string to lowercase
Pad StringPad a string to a specified length
String ReplaceReplace occurrences of a substring in a string
String ReverseReverse the characters in a string
SlugifyConvert text to URL-friendly slug
Split StringSplit a string into an array using a delimiter
TemplateRender a template with variable substitution
Title Case StringConvert string to title case
String TrimRemove whitespace from both ends of a string
Truncate StringTruncate a string to a maximum length
String UppercaseConvert a string to uppercase

Modules

String Lowercase

string.lowercase

Convert a string to lowercase

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-The text string to process

Output:

FieldTypeDescription
resultstringLowercase converted string
originalstringLowercase converted string
statusstringLowercase converted string

Pad String

string.pad

Pad a string to a specified length

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Text to pad
lengthnumberYes-Text to pad
pad_charstringNoTarget length
positionstringNoendCharacter to pad with

Output:

FieldTypeDescription
resultstringPadded string
originalstringPadded string
addednumberPadded string

String Replace

string.replace

Replace occurrences of a substring in a string

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-The text string to process
searchstringYes-The substring to search for in the input text
replacestringYes-Text to replace matches with (leave empty to remove matches)

Output:

FieldTypeDescription
resultstringString with replacements applied
originalstringString with replacements applied
searchstringString with replacements applied
replacestringOriginal input string
statusstringSearch string that was replaced

String Reverse

string.reverse

Reverse the characters in a string

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-The text string to process

Output:

FieldTypeDescription
resultstringReversed string
originalstringReversed string
lengthnumberReversed string

Slugify

string.slugify

Convert text to URL-friendly slug

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Text to slugify
separatorstringNo-Text to slugify
lowercasebooleanNoTrueWord separator
max_lengthnumberNo0Convert to lowercase

Output:

FieldTypeDescription
resultstringMaximum slug length (0 = unlimited)
originalstringURL-friendly slug

Split String

string.split

Split a string into an array using a delimiter

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-The text string to process
delimiterselect (,, ;, , , `
, , -, _`)NoCharacter(s) to split the string on

Output:

FieldTypeDescription
partsarrayArray of split string parts
resultarrayArray of split string parts
lengthnumberArray of split string parts
originalstringAlias for parts - array of split string parts
delimiterstringNumber of parts after split
statusstringOriginal input string

Template

string.template

Render a template with variable substitution

Parameters:

NameTypeRequiredDefaultDescription
templatestringYes-Template string with {{variable}} placeholders
variablesobjectYes-Variables to substitute
missing_valuestringNo-Value for undefined variables
preserve_missingbooleanNoFalseValue for undefined variables

Output:

FieldTypeDescription
resultstringKeep placeholder if variable is missing
replacednumberRendered template
missingarrayRendered template

Title Case String

string.titlecase

Convert string to title case

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-The text string to process

Output:

FieldTypeDescription
resultstringTitle case converted string

Example: Convert to title case

yaml
text: hello world from flyto

Example: Format name

yaml
text: john doe

String Trim

string.trim

Remove whitespace from both ends of a string

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-The text string to process

Output:

FieldTypeDescription
resultstringTrimmed string with whitespace removed
originalstringTrimmed string with whitespace removed
statusstringTrimmed string with whitespace removed

Truncate String

string.truncate

Truncate a string to a maximum length

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-Text to truncate
lengthnumberYes-Text to truncate
suffixstringNo...Maximum length
word_boundarybooleanNoFalseText to append if truncated

Output:

FieldTypeDescription
resultstringBreak at word boundary
originalstringTruncated string
truncatedbooleanTruncated string
removednumberOriginal string

String Uppercase

string.uppercase

Convert a string to uppercase

Parameters:

NameTypeRequiredDefaultDescription
textstringYes-The text string to process

Output:

FieldTypeDescription
resultstringUppercase converted string
originalstringUppercase converted string
statusstringUppercase converted string

Released under the Apache 2.0 License.