Omnistudio String Functions

Functions that operate on strings.

Omnistudio BASE64ENCODE Function

Encodes an input value into Base64 format.

Base64 is a common ASCII-based encoding. In an encoded result, trailing = characters are padding.

Signature

BASE64ENCODE(data)

Return Value

String

Parameters

Parameter

Data Type

Necessity

Description

data

Any data type

Required

The input value to be encoded into Base64 format. The function does not accept a null value or an empty string.

String Encoding Example
String Encoding Example

Formula: BASE64ENCODE("Encode this string.")

Return value: "RW5jb2RlIHRoaXMgc3RyaW5nLg=="

Date Encoding Example
Date Encoding Example

Formula: BASE64ENCODE("2003-02-01T16:35:30-0500")

Return value: "MjAwMy0wMi0wMVQxNjozNTozMC0wNTAw"

Number Encoding Example
Number Encoding Example

Formula: BASE64ENCODE(1024)

Return value: "MTAyNA=="

JSON Object Encoding Example
JSON Object Encoding Example

Sample data:

"Contact": {
  "FirstName": "Thomas",
  "MiddleName": "Alva",
  "LastName": "Edison"
}

Formula: BASE64ENCODE(Contact)

Return value: "e0xhc3ROYW1lPUVkaXNvbiwgTWlkZGxlTmFtZT1BbHZhLCBGaXJzdE5hbWU9VGhvbWFzfQ=="

Omnistudio CONCAT Function

Concatenates two or more strings into a single string.

Signature

CONCAT(string...)

Return Value

String

Parameters

Parameter

Data Type

Necessity

Description

string...

String

Required

A comma-separated list of one or more strings to be concatenated into a single string. To separate input strings in the result, include a separator string (such as " ") between each pair of strings. You can concatenate numbers, which the function coerces into strings.

If you specify only a single string, the function returns that string. If you specify multiple strings, the function ignores null values and empty strings. You cannot specify a null value or an empty string as the only input value.

String and Number Concatentation Example
String and Number Concatentation Example

Formula: CONCAT("AGE", ": ", 23)

Return value: "AGE: 23"

Number and String Concatentation Example
Number and String Concatentation Example

Formula: CONCAT(23, " years of age")

Return value: "23 years of age"

JSON Object Concatentation Example
JSON Object Concatentation Example

Sample data:

"stringField1": "abc",
"stringField2": "ABC"

Formula: CONCAT(%stringField1%, " ", %stringField2%)

Return value: "abc ABC"

JSON Object Concatentation Example
JSON Object Concatentation Example

Sample data:

"Contact": {
  "FirstName": "Mike",
  "LastName": "Smith"
}

Formula: CONCAT(Contact:FirstName, " ", Contact:LastName)

Return value: "Mike Smith"

Omnistudio JOIN Function

Joins two or more string into a single string, separating each string by a specified token.

Signature

JOIN(string..., token)

Return Value

String

Parameters

Parameter

Data Type

Necessity

Description

string...

String

Required

A comma-separated list of one or more strings to be joined into a single string. In the joined string, each specified string is separated by the token. You can join numbers, which the function coerces into strings. If you specify only a single string and a token, the function returns only the string.

If you specify multiple values and any are null, the function omits the null values from the joined string. If you specify multiple values and any are empty strings, the function joins only the values that precede the empty string. You cannot specify a null value or an empty string as the only input value.

token

String

Required

A value to be placed between each input string at the position at which the strings are joined. If you specify a number, the function coerces it into a string. If you specify an empty string, the function omits the empty string from the joined string. If you specify multiple input strings and no token, the function uses the last value of the input as the token.

Alphabetic Array Example
Alphabetic Array Example

Sample data: "AlphabeticArray": [ "a", "A", "b", "B", "c", "C" ]

Formula: JOIN(AlphabeticArray, ", ")

Return value: "a, A, b, B, c, C"

Numeric Array Example
Numeric Array Example

Sample data: "NumericArray": [ 1, 2, 3, 4 ]

Formula: JOIN(NumericArray, " / ")

Return value: "1 / 2 / 3 / 4"

JSON Object Example
JSON Object Example

Sample data:

"Contact": {
  "FirstName": "Thomas",
  "MiddleName": "Alva",
  "LastName": "Edison"
}

Formula: JOIN(Contact:FirstName, Contact:MiddleName, Contact:LastName, " ")

Return value: "Thomas Alva Edison"

JSON Array Example
JSON Array Example

Sample data:

"Contacts": [
  {
    "id": "0036ab",
    "lastName": "Jones",
    "firstName": "Cathy"
  },
  {
    "id": "2787kq",
    "lastName": "Smith",
    "firstName": "Albert"
  },
  {
    "id": "3610xr",
    "lastName": "Smith",
    "firstName": "Ben"
  }
]

Formula: JOIN(Contacts:id, ', ')

Return value: "0036ab, 2787kq, 3610xr"

Alphabetic List and No Token Example
Alphabetic List and No Token Example

Formula: JOIN("a", "b", "c")

Formula: JOIN(("a", "b", "c"))

Return value: "acb"

Omnistudio MAXSTRING Function

Returns the string that is last lexicographically in a list of two or more strings.

The function performs case-sensitive comparisons of the input strings.

Signature

MAXSTRING(string...)

Return Value

String

Parameters

Parameter

Data Type

Necessity

Description

string...

String

Required

Two or more strings from which the string that is last lexicographically is to be returned. If you specify numbers, the function coerces them into strings.

If you specify only a single string, the function returns that string. If you specify multiple strings, the function ignores null values and empty strings. You cannot specify a null value or an empty string as the only input value.

Maximum String Example
Maximum String Example

Formula: MAXSTRING("Amy", "Ziggy", "Michael")

Return value: "Ziggy"

Maximum Number Example
Maximum Number Example

Formula: MAXSTRING(1, 2, 3)

Return value: "3"

Uppercase Characters Example
Uppercase Characters Example

Formula: MAXSTRING("A", "B", "C")

Return value: "C"

Uppercase and Lowercase Characters Example
Uppercase and Lowercase Characters Example

Formula: MAXSTRING("A", "b", "C")

Return value: "b"

Omnistudio SPLIT Function

Splits a string into substrings at each position of a specified token.

The function performs a case-sensitive search for the token. If it splits the input string into two or more substrings, the function returns an array of strings. Otherwise, it returns the input string.

Signature

SPLIT(string, token)

Return Value

String[]

Parameters

Parameter

Data Type

Necessity

Description

string

String

Required

The string to be split into substrings. If you specify a number, the function coerces it into a string. The string cannot be null or an empty string.

token

String

Required

A string that specifies the position at which the input string is to be split into substrings. The token is interpreted as a Java regular expression (regex) pattern. Special regex characters such as ., *, +, ?, |, (, ), [, ], {, }, ^, $, and \ have special meaning. To split on a literal special character, escape it with a backslash (\). For example, to split on a period, use \. as the token. The function splits the string at each occurrence of the token. It does not include the token in the substrings that it returns. If you specify a number, the function coerces it into a string. The function returns the input string if the token is not present in the string.

If you specify a null token, the function returns the input string. If you specify an empty string as the token, the function returns an array that includes each character of the input value.

Split String Example
Split String Example

Sample data: %Name% == "Anne Marie Gupta"

Formula: SPLIT(%Name%, " ")

Return value: [ "Anne", "Marie", "Gupta" ]

Split Number Example
Split Number Example

Formula: SPLIT(12345, 3)

Return value: [ "12", "45" ]

Token Not Found Example
Token Not Found Example

Formula: SPLIT("abcde", "C")

Return value: "abcde"

Omnistudio STRINGINDEXOF Function

Returns the start index of a substring within a string.

The function performs a case-sensitive search for the substring. The position of the first character in the string is 0. If the substring occurs multiple times in the string, the function returns the index of the first occurence. If it doesn't find the substring in the string, the function returns -1.

Signature

STRINGINDEXOF(string, substring)

Return Value

Integer

Parameters

Parameter

Data Type

Necessity

Description

string

String

Required

The string in which to search for the substring. If you specify a number, the function coerces it into a string. The string cannot be null or an empty string.

substring

String

Required

The substring for which to search in the string. If you specify a number, the function coerces it into a string. The substring cannot be null or an empty string.

Substring Found Example
Substring Found Example

Formula: STRINGINDEXOF("This is the test string.", "test")

Return value: 12

Substring Not Found Example
Substring Not Found Example

Formula: STRINGINDEXOF("This is the test string.", "testy")

Return value: -1

Multiple Occurrences of Substring Example
Multiple Occurrences of Substring Example

Formula: STRINGINDEXOF("The string of strings.", "string")

Return value: 4

Numeric Values Example
Numeric Values Example

Formula: STRINGINDEXOF(1234, 34)

Return value: 2

Omnistudio SUBSTRING Function

Returns a substring of a string based on specified start and end indexes.

The position of the first character in the string is 0. The position of the last character in the string is the length of the string. The function performs a case-sensitive search for a character or string used as a start or end index.

Signature

SUBSTRING(string, startIndex, endIndex)

Return Value

String

Parameters

Parameter

Data Type

Necessity

Description

string

String

Required

The string from which a substring is to be returned. The string cannot be null or an empty string.

startIndex

Integer or string

Optional

The position of the first character in the substring. The start index is inclusive, so the position of the fist character is 0.

  • If you specify a negative integer or an integer that is greater than the length of the string, the function uses 0.

  • If you specify a single character, the function uses the position of the first occurrence of that character.

  • If you specify a string, the function uses the position of the first character of the first occurrence of the string.

  • If you specify null or an empty string, the function uses 0.

If you omit a start index, the function uses 0 by default. In this case, you must also omit the end index.

endIndex

Integer or string

Optional

The position of the last character in the substring. The end index is exclusive, so the position of the last character is the length of the string.

  • If you specify a negative integer or an integer that is greater than the length of the string, the function uses the length of the string.

  • If you specify a single character, the function uses the position of the first occurrence of that character minus one.

  • If you specify a string, the function uses the position of the first character of the first occurrence of the string minus one.

  • If you specify null or an empty string, the function uses the length of the string.

If you omit an end index, the function uses the length of the string by default. If you specify an end index, you must also specify a start index.

No Start or End Index Example
No Start or End Index Example

Sample data: "InputString": "The string."

Formula: SUBSTRING(InputString)

Return value: "The string."

Numeric Start Index Only Example
Numeric Start Index Only Example

Sample data: "InputString": "The string."

Formula: SUBSTRING(InputString, 4)

Return value: "string."

Numeric Start and End Indexes Example
Numeric Start and End Indexes Example

Sample data: "InputString": "The string."

Formula: SUBSTRING(InputString, 0, 11)

Return value: "The string."

Numeric Start and End Indexes Example
Numeric Start and End Indexes Example

Sample data: "InputString": "The string."

Formula: SUBSTRING(InputString, 0, 4)

Return value: "The "

Numeric Start and End Indexes Example
Numeric Start and End Indexes Example

Sample data: "InputString": "The string."

Formula: SUBSTRING(InputString, 4, 10)

Return value: "string"

Character Start Index Only Example
Character Start Index Only Example

Sample data: "InputString": "The string."

Formula: SUBSTRING(InputString, "r")

Return value: "ring."

Character Start and End Indexes Example
Character Start and End Indexes Example

Sample data: "InputString": "The string."

Formula: SUBSTRING(InputString, "r", ".")

Return value: "ring"

String Start Index Only Example
String Start Index Only Example

Sample data: "InputString": "The string."

Formula: SUBSTRING(InputString, "string")

Return value: "string."

String Start and End Indexes Example
String Start and End Indexes Example

Sample data: "InputString": "The string."

Formula: SUBSTRING(InputString, "The", "ring.")

Return value: "The st"

String Start and End Indexes Example
String Start and End Indexes Example

Formula: SUBSTRING("The string of strings.", "The", "ring")

Return value: "The st"

Omnistudio TOSTRING Function

Converts input data into a string.

Signature

TOSTRING(data)

Return Value

String

Parameters

Parameter

Data Type

Necessity

Description

data

Any data type

Required

The data to be converted into a string. The function does not accept a null value or an empty string.

Single Number Example
Single Number Example

Formula: TOSTRING(3.0)

Return value: "3.0"

JSON Object Example
JSON Object Example

Formula: TOSTRING({ "key": "value" })

Return value: "key, value"

JSON Object Example
JSON Object Example

Formula: TOSTRING({ "Amount": 750.00 })

Return value: "Amount, 750.00"

Quoted JSON Object Example
Quoted JSON Object Example

Formula: TOSTRING('{ "key": "value" }')

Return value: "{ "key": "value" }"

JSON Array Example
JSON Array Example

Formula: TOSTRING([ { "key1": "value1" }, { "key2": "value2" } ])

Return value: "key1, value1, key2, value2"