Skip to main content
String Utilities

Explore the string utility steps in Torq.

Updated over 2 months ago

Use these utility steps for manipulating strings. See below for examples of each step's input and output.

Convert string to lowercase

Converts all of the characters in the given string into lowercase.

Input

Convert This String to Lowercase

Output

convert this string to lowercase


Convert string to title case

Converts the first character of each word into uppercase.

Input

Convert this string to title case

Output

Convert This String To Title Case


Convert string to uppercase

Converts all of the characters in the given string into uppercase

Input

Convert this string to uppercase

Output

CONVERT THIS STRING TO UPPERCASE


Defang or refang entity

Defangs or refangs the given IP, URL or email address. The following sub-strings will be affected: '.', '@', 'http'.

Input

nora.singh@twistt.io

Output

{"result": "nora[.]singh[@]twistt[.]io",}

Escape JSON String

Escapes certain characters in a string, for example, /, to make the string compatible with JSON format.

Input

The string which needs "escaping"\n

Output

The string which needs \"escaping\"\\n


Render Template

This step renders a template.

Template

Hello, this is my {{`{{.name}}`}}

Variables

{"name": "Bob"}


Replace substring in text

Replace a substring with another string in the provided text.

Input

Like this and like this.

Old_Text

this

New_Text

that

Instances

1

Output

Like that and like this.


Split Text

Splits the text into an array of strings according to the provided separator. Note that the text in the separator is removed from the string.

Input

Let's split this text.

Separator

this

Output

"Let's split ",

" text."


Trim spaces before and after string

Removes empty spaces before and after a string.

Input

Remove the 3 empty spaces before and this string.

Output

Remove the 3 empty spaces before and this string.


Trim string characters

Trims occurrences of the given characters from the beginning and/or end of a string

Input

I want to trim the following characters.

Characters

I w.rs** **

Side_to_Trim

Trim prefix and suffix

Output

ant to trim these characte.


Trim string prefix

Trims the defined prefix of the string

Input

The prefix in this example is 'The prefix'.

Prefix

The prefix

Output

in this example is 'The prefix'.


Trim string suffix

Trims the defined suffix of the string.

Input

The suffix in this example is 'the suffix'.

Prefix

the suffix

Output

The suffix in this example is


Truncate Text

Limits the string to the number of characters defined.

Input

Truncate this text to 15 characters.

Limit

15

Output

Truncate this t

Did this answer your question?