The String connector lets you transform the text value of a variable in your PingOne DaVinci flow.
You can use the String connector to:
- Convert strings to lowercase, uppercase, or title case
- Convert any type of variable to a different data type
- Concatenate two or more strings
- Encode and decode a string
- Search and replace text in a string
- Generate a random string
- Remove white space from a string
Setup
Resources
For information and setup help, see the following:
- DaVinci documentation:
Configuring the String connector
Add the connector in DaVinci as shown in Adding a connector. There is no connector configuration.
Using the connector in a flow
- Changing the capitalization of a string
-
You can use the Convert to Lowercase, Covert to Uppercase, or Convert to Title Case capabilities to change a string's capitalization.
For example, if your Input String is myVariableValue, you'll get one of the following results depending on the capability you choose:
- MYVARIABLEVALUE
- myvariablevalue
- Myvariablevalue
Changing the case of a string can help you to standardize values before you compare them, such as when using the Function connector.
You can use the Convert to Lowercase capability with the Concatenate capability to generate usernames. For example, take the inputs John and Smith and convert them to lowercase before using the Concatenate capability to convert both variables to johnsmith@example.com.
To remove an unnecessary blank space at the beginning or end of your output string, enable Remove White Space.
- Changing values to another data type
-
You can use the Change Data Type capability to change the data of any value to a Boolean, Number, or String. For example, if your Input Value is the string true you can convert to the boolean true. Or take the number 3 and convert to the string "3".
Changing the data type is useful for testing that the incoming data is in the correct format. For example, if you want driver's license numbers, such as "456123789" from a string to number, the capability will return True. However, if the capability instead receives a passport ID, such as "P123456AA", it will return False (error code 400; invalid input).
- Concatenating two strings
-
The Concatenate capability lets you merge multiple strings together.
For example, take the input strings john and smith and convert to johnsmith@example.com:
- In the Input Value section, add john to the Value 1 field or click {} and select a variable from your flow that contains the string that you want to concatenate.
- In the Value 2, add smith or click {} and select a variable from your flow that contains the string that you want to concatenate.
- Click Add to include an additional field to concatenate.
- In the new Value 3 field, add an email domain such as @example.com.
- Decoding or encoding a string
-
The Decode and Encode capabilities let you decode and encode a string from one of several formats: Base64, URL, or Base64 URL.
For example, take the plain text input johnsmith@example.com and encode with Base64 to am9obnNtaXRoQGV4YW1wbGUuY29t.
- Searching and replacing content
-
The Find Substring capability lets you find a substring and its index. The outputs will include a
found
variable which is a boolean returning true if the substring is found and anindex
variable which is the substring's position in the string.For example, take the string johnsmith@example.com and search for the substring exa and you get the following output:
The Find and Replace capability lets you search for text using literal matching or a regular expression. For example, you could replace every instance of
test
withproduction
:- In the Input String field, click {} and select a variable from your flow that contains the string that you want to search for.
- If your original variable value has blank space at the end that you don't want, enable Trim White Space to remove it.
- In the Input String field, enter the text that you want to
find in the string, such as test. Alternatively, you can
enter a regular expression, such as /te[xs]t/g, which will
match both
test
andtext
and the/g
flag will apply the change to all matches in the input string. - If you entered a regular expression in the Input String
field, enable Search Using Regex.Note:
Replace Mode is for simple matching. When Search Using Regex is enabled, the regex itself determines which matched text is replaced.
- In the New Value field, enter the string that you want to replace the match with, such as production.
- Generating random strings
-
The Generate String capability lets you create pseudorandom numeric or alphanumeric strings of a certain length. You can use this to create temporary passwords or add unique suffixes to user identifiers.
No special flow configuration is needed. Add the capability and populate its properties according to the help text.
- Removing white space from string
-
The Remove White Space capability lets you remove leading or trailing white space from a variable.