Updated on 2025-09-05 GMT+08:00

String Functions

The following table lists the string functions supported by SecMaster SQL syntax.

Table 1 String functions supported by SecMaster SQL syntax

Function

Function Description

string1 || string2

Returns the concatenation of STRING1 and STRING2.

CHAR_LENGTH(string) CHARACTER_LENGTH(string)

Returns the number of characters in a string.

UPPER(string)

Returns a string in uppercase.

LOWER(string)

Returns a string in lowercase.

TRIM([ BOTH | LEADING | TRAILING ] string1 FROM string2)

Returns the result of deleting the string starting and ending with STRING1 from STRING2. By default, spaces at both ends will be deleted.

SUBSTRING(string FROM integer1 [ FOR integer2 ])

Returns a substring of STRING starting from position INT1 with length INT2 (default to the end).

REPLACE(string1, string2, string3)

Returns a new string where all occurrences of STRING2 in STRING1 are replaced with STRING3 (non-overlapping). For example, 'hello world'.replace('world', 'flink') returns 'hello flink'; 'ababab'.replace('abab', 'z') returns 'zab'.

CONCAT(string1, string2, ...)

Returns a string that concatenates string1, string2, ..., together. If any parameter is NULL, NULL is returned. For example, CONCAT('AA', 'BB', 'CC') returns "AABBCC".

CONCAT_WS(string1, string2, string3, ...)

Returns a string that concatenates STRING2, STRING3, ..., together with the separator STRING1. A separator is added between each string to be concatenated. If STRING1 is NULL, NULL is returned. Compared with concat(), concat_ws() automatically skips NULL parameters. For example, concat_ws('~', 'AA', Null(STRING), 'BB', '', 'CC') returns "AA~BB~~CC".

REGEXP(string1, string2)

Returns TRUE if any (possibly empty) substring of string1 matches the Java regular expression string2, otherwise it returns FALSE. Returns NULL if the value of any parameter is NULL.

SPLIT_INDEX(string1, string2, integer1)

Splits string1 by the delimiter string2 and returns the substring from the index specified by integer (starting from zero). If the integer is negative, returns NULL. Returns NULL if the value of any parameter is NULL.

SUBSTR(string, integer1[, integer2])

Returns a substring of a string starting from position integer1 with a length of integer2 (default to the end).