DuroDBMS API  1.7
Built-in string operators

OPERATOR ||

OPERATOR || (s1 string, s2 string) RETURNS string;

Description

The string concatenation operator.

Return value

The result of the concatenation of the operands.


OPERATOR strlen

OPERATOR strlen (s string) RETURNS integer;

Description

The string length operator.

Return value

The length of s, in code points.


OPERATOR strlen_b

OPERATOR strlen_b (s string) RETURNS integer;

Description

The string length operator, returning the number of bytes.

Return value

The length of s, in bytes.


OPERATOR substr

OPERATOR substr(s string, start integer, length integer) RETURNS string;

Description

Extracts a substring.

Return value

The substring of s with length length starting at position start. length and start are measured in code points, according to the current encoding.

Errors

invalid_argument_error
start is negative, or start + length is greater than strlen(s).

OPERATOR substr_b

OPERATOR substr_b(s string, start integer, length integer) RETURNS string;

OPERATOR substr_b(s string, start integer) RETURNS string;

Description

Extracts a substring.

Return value

The substring of s with length length starting at position start. length and start are measured in bytes. If called with 2 arguments, the substring extends to the end of s.

Errors

invalid_argument_error
start or length are negative, or start + length is greater than strlen(s).

OPERATOR strfind_b

OPERATOR strfind_b (haystack string, needle string) RETURNS integer;

OPERATOR strfind_b (haystack string, needle string, int pos) RETURNS integer;

Description

Finds the first occurrence of the string needle in the string haystack. If called with 3 arguments, it finds the first occurrence after pos, where pos is a byte offset.

Return value

The position of the substring, in bytes, or -1 if the substring has not been found.


OPERATOR starts_with

OPERATOR starts_with (s string, prefix string) RETURNS boolean;

Description

Tests if string s starts with string prefix.

Return value

TRUE if s starts with prefix, FALSE otherwise


OPERATOR like

OPERATOR like (s string, pattern string) RETURNS boolean;

Description

Pattern matching operator. A period ('.') matches a single character; an asterisk ('*') matches zero or more characters.

Return value

TRUE if s matches pattern, FALSE otherwise.


OPERATOR regex_like

OPERATOR regex_like (s string, pattern string) RETURNS boolean;

Description

The regular expression matching operator.

Return value

TRUE if s matches pattern, FALSE otherwise.


OPERATOR format

OPERATOR format (format string, ...) RETURNS string;

Description

Generates a formatted string in the style of sprintf. The arguments passed after format must be of type string, integer, or float and must match the format argument.

Return value

The formatted output string.


OPERATOR lower

OPERATOR lower (s string) RETURNS string;

Description

Returns the string s, converted to lowercase.

Return value

The string, converted to lowercase.


OPERATOR upper

OPERATOR upper (s string) RETURNS string;

Description

Returns the string s, converted to uppercase.

Return value

The string, converted to uppercase.