Intro
Below is a comprehensive list of Text data formatters available in App Connect (client-side), accompanied by explanations outlining the purpose and functionality of each.
Text Formatters
Starts With:
- Checks if the string starts with the given value (optionally case-insensitive).
- Example:
('Hello World').startsWith('Hello')returnstrue
Ends With:
- Checks if the string ends with the given value.
- Example:
('Hello World').endsWith('World')returnstrue
Contains:
- Checks if the string contains the given value.
- Example:
('Hello World').contains('World')returnstrue
Not Contains:
- Checks if the string does not contain the given value.
- Example:
('Hello World').notContains('Hi')returnstrue
Search:
- Searches for one or more words in a string (any or all matches).
- Example:
('Hello Big World').search('Big World', true)returnstrue
Fuzzy Search:
- Performs a fuzzy match search on a string.
- Example:
('hello world').fuzzySearch('hwd')returnstrue
In Array:
- Checks if the string exists in an array.
- Example:
('red').inArray(['red','blue'])returnstrue
Not In Array:
- Checks if the string does not exist in an array.
- Example:
('green').notInArray(['red','blue'])returnstrue
Test Regex:
- Tests the string against a regular expression.
- Example:
('abc123').test(/[0-9]+/)returnstrue
Convert To Lowercase:
- Converts the string to lowercase.
- Example:
('Hello').lowercase()returns'hello'
Convert To Uppercase:
- Converts the string to uppercase.
- Example:
('Hello').uppercase()returns'HELLO'
Slugify String:
- Converts a string into a URL-friendly slug.
- Example:
('Hello World!').slugify()returns'hello-world'
Camelize String:
- Converts a string into camelCase format.
- Example:
('hello world').camelize()returns'helloWorld'
Capitalize String:
- Capitalizes the first character of the string.
- Example:
('hello').capitalize()returns'Hello'
Dasherize String:
- Converts spaces and capitals into dashed format.
- Example:
('Hello World').dasherize()returns'hello-world'
Humanize String:
- Converts technical strings into readable text.
- Example:
('hello_world').humanize()returns'Hello world'
Underscore String:
- Converts the string to underscore format.
- Example:
('Hello World').underscore()returns'hello_world'
Titlecase String:
- Capitalizes the first letter of each word.
- Example:
('hello world').titlecase()returns'Hello World'
Camelcase String:
- Converts string to camelCase (space based).
- Example:
('hello world').camelcase()returns'helloWorld'
Sub String:
- Extracts part of the string.
- Example:
('Hello World').substr(6,5)returns'World'
Substring:
- Extracts string between indexes.
- Example:
('Hello World').substring(0,5)returns'Hello'
Replace String:
- Replaces values using string or regex.
- Example:
('Hello World').replace('World','AI')returns'Hello AI'
Trim String:
- Removes leading and trailing spaces.
- Example:
(' hello ').trim()returns'hello'
Trim Left:
- Removes whitespace from the left.
- Example:
(' hello').trimLeft()returns'hello'
Trim Right:
- Removes whitespace from the right.
- Example:
('hello ').trimRight()returns'hello'
Concat String:
- Concatenates two strings.
- Example:
('Hello ').concat('World')returns'Hello World'
Truncate String:
- Truncates text with optional word boundary and suffix.
- Example:
('Hello World').trunc(5,true)returns'Hello...'
Strip Tags:
- Removes HTML tags and scripts.
- Example:
('<p>Hello</p>').stripTags()returns'Hello'
Pad Start:
- Pads the string at the beginning.
- Example:
('5').padStart(3,'0')returns'005'
Pad End:
- Pads the string at the end.
- Example:
('5').padEnd(3,'0')returns'500'
Repeat String:
- Repeats the string multiple times.
- Example:
('Hi').repeat(3)returns'HiHiHi'
Word Count:
- Counts words in the string.
- Example:
('Hello Big World').wordCount()returns3
Length:
- Returns number of characters.
- Example:
('Hello').length()returns5
Split String:
- Splits the string into an array.
- Example:
('a,b,c').split(',')returns['a','b','c']
Parse JSON:
- Converts JSON string into object.
- Example:
('{"a":1}').parseJSON()returns{a:1}
Encode URI Component:
- Encodes URI component.
- Example:
('hello world').encodeURIComponent()returns'hello%20world'
Encode URI:
- Encodes full URI.
- Example:
('https://site.com?a=1').encodeURI()
Decode URI Component:
- Decodes encoded URI component.
- Example:
('hello%20world').decodeURIComponent()returns'hello world'
Decode URI:
- Decodes encoded URI.
- Example:
('https://site.com%20test').decodeURI()