This article demonstrates the behavior of string data when string functions are used in the formula mode.
What you'll need:
Skill level: Intermediate
Time required: 3 minutes
- Skills for appropriate usage of formulas for strings defined as input
Quickwork supports a variety of string formulas. Using these formulas, one can count characters, compare data, perform string validations, and so on.
Note: Most formulas will return an error and stop the journey execution if operated on blank input fields.
In the examples below, we will look at some of the methods that can be used to manipulate a string of text, which in this case the input string is John Doe.
Conditionals
This section will cover formulas that allow you to apply conditions (if-else) to your strings.
1) blank?This function checks the input string and returns true if it is an empty string or if it is null:
Example | Result |
"John Doe".blank? | false |
"".blank? | true |
null.blank | false |
2) length
This function returns the number of characters within an input string, including the white spaces:
Example | Result |
"John Doe".length | 8 |
" john doe ".length | 13 |
3) lowercase
This function converts all characters from the input string into lowercase:
Example | Result |
"John Doe".lowercase | "john doe" |
"Hello, How may I help you?".lowercase | "hello, how may i help you?" |
4) trimLeft
This function (left strip) removes the white spaces at the beginning of the input string:
Example | Result |
" John Doe".trimLeft | "John Doe" |
" Hello, How may I help you?".trimLeft | "Hello, How may I help you?" |
4) trimRight
This function (right strip) removes the white spaces at the beginning of the input string:
Example | Result |
"John Doe ".trimRight | "John Doe" |
"Hello, How may I help you? ".trimRight | "Hello, How may I help you?" |
5) uppercase
This function converts all characters from the input string into uppercase:
Example | Result |
"john doe".uppercase | "JOHN DOE" |
"hello, how may i help you?".uppercase | "HELLO, HOW MAY I HELP YOU?" |
Comments
0 comments
Please sign in to leave a comment.