IBM Cloud Docs
DataPrime string functions

DataPrime string functions

This guide provides a glossary of IBM® Cloud Logs DataPrime string functions.

chr

Returns the Unicode code point number as a single character string.

chr(number: number): string

codepoint

Returns the Unicode code point of the only character of string.

codepoint(string: string): number

concat

Concatenates multiple strings into one.

concat(value: string, ...values: string): string

contains

Returns true if substring is contained in string

contains(string: string, substring: string): bool

endsWith

Returns true if string ends with suffix

endsWith(string: string, suffix: string): bool

indexOf

Returns the position of substring in string, or -1 if not found.

indexOf(string: string, substring: string): number

length

Returns the length of value

length(value: string): number

ltrim

Removes whitespace to the left of the string value

ltrim(value: string): string

matches

Evaluates the regular expression pattern and determines if it is contained within string.

matches(string: string, regexp: regexp): bool

pad

Left pads string to charCount. If size < fillWith.length() of string, result is truncated. See padLeft for more details. Alias for padLeft.

pad(value: string, charCount: number, fillWith: string): string

padLeft

padLeft(value: string, charCount: number, fillWith: string): string

Left pads string to charCount. If size < fillWith.length() of string, result is truncated.

padRight

Right pads string to charCount. If size < fillWith.length() of string, result is truncated.

padRight(value: string, charCount: number, fillWith: string): string

regexpSplitParts

Splits string on regexp-delimiter, returns the field at index. Indexes start with 1.

regexpSplitParts(string: string, delimiter: regexp, index: number): string

rtrim

Removes whitespace to the right of the string value.

rtrim(value: string): string

splitParts

Splits string on delimiter, returns the field at index. Indexes start with 1.

splitParts(string: string, delimiter: string, index: number): string

startsWith

Returns true if string starts with prefix.

startsWith(string: string, prefix: string): bool

substr

Returns the substring in value, from position from and up to length length.

substr(value: string, from: number, length: number?): string

toLowerCase

Converts value to lowercase.

toLowerCase(value: string): string

toUpperCase

Converts value to uppercase.

toUpperCase(value: string): string

trim

Removes whitespace from the edges of a string value.

trim(value: string): string

String interpolation

  • this is an interpolated {$d.some_keypath} string{$d.some_keypath} will be replaced with the evaluated expression that is enclosed by the brackets.

  • this is how you escape \{ and \} and \` – The backward slash \ is used to escape characters such as { and } that are used for keypaths.