strings

package
v2.0.0-alpha.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Concat

func Concat(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

CONCAT concatenates one or more instances of String, or an arrayList. @param {String, repeated | String[]} src - The source string / array. @return {String} - A string value.

func ConcatWithSeparator

func ConcatWithSeparator(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

CONCAT_SEPARATOR concatenates one or more instances of String, or an arrayList with a given separator. @param {String} separator - The separator string. @param {String, repeated | String[]} src - The source string / array. @return {String} - Concatenated string.

func Contains

func Contains(_ context.Context, args ...runtime.Value) (runtime.Value, error)

CONTAINS returns a value indicating whether a specified substring occurs within a string. @param {String} str - The source string. @param {String} search - The string to seek. @param {Boolean} [returnIndex=False] - Values which indicates whether to return the character position of the match is returned instead of a boolean. @return {Boolean | Int} - A value indicating whether a specified substring occurs within a string.

func DecodeURIComponent

func DecodeURIComponent(_ context.Context, arg runtime.Value) (runtime.Value, error)

DECODE_URI_COMPONENT returns the decoded String of uri. @param {String} uri - Uri to decode. @return {String} - Decoded string.

func EncodeURIComponent

func EncodeURIComponent(_ context.Context, arg runtime.Value) (runtime.Value, error)

ENCODE_URI_COMPONENT returns the encoded String of uri. @param {String} uri - Uri to encode. @return {String} - Encoded string.

func EscapeHTML

func EscapeHTML(_ context.Context, arg runtime.Value) (runtime.Value, error)

ESCAPE_HTML escapes special characters like "<" to become "&lt;". It escapes only five such characters: <, >, &, ' and ". UnescapeString(EscapeString(s)) == s always holds, but the converse isn't always true. @param {String} uri - Uri to escape. @return {String} - Escaped string.

func FindFirst

func FindFirst(_ context.Context, args ...runtime.Value) (runtime.Value, error)

FIND_FIRST returns the position of the first occurrence of the string search inside the string text. Positions start at 0. @param {String} str - The source string. @param {String} search - The string to seek. @param {Int} [start] - Limit the search to a subset of the text, beginning at start. @param {Int} [end] - Limit the search to a subset of the text, ending at end @return {Int} - The character position of the match. If search is not contained in text, -1 is returned. If search is empty, start is returned.

func FindLast

func FindLast(_ context.Context, args ...runtime.Value) (runtime.Value, error)

FIND_LAST returns the position of the last occurrence of the string search inside the string text. Positions start at 0. @param {String} src - The source string. @param {String} search - The string to seek. @param {Int} [start] - Limit the search to a subset of the text, beginning at start. @param {Int} [end] - Limit the search to a subset of the text, ending at end @return {Int} - The character position of the match. If search is not contained in text, -1 is returned. If search is empty, start is returned.

func Fmt

func Fmt(_ context.Context, args ...runtime.Value) (runtime.Value, error)

FMT formats the template using these arguments. @param {String} template - template. @param {Any, repeated} args - template arguments. @return {String} - string formed by template using arguments.

func FromBase64

func FromBase64(_ context.Context, arg runtime.Value) (runtime.Value, error)

FROM_BASE64 returns the value of a base64 representation. @param {String} str - The string to decode. @return {String} - The decoded string.

func JSONParse

func JSONParse(_ context.Context, arg runtime.Value) (runtime.Value, error)

JSON_PARSE returns a value described by the JSON-encoded input string. @param {String} str - The string to parse as JSON. @return {Any} - Parsed value.

func JSONStringify

func JSONStringify(_ context.Context, arg runtime.Value) (runtime.Value, error)

JSON_STRINGIFY returns a JSON string representation of the input value. @param {Any} str - The input value to serialize. @return {String} - JSON string.

func LTrim

func LTrim(_ context.Context, args ...runtime.Value) (runtime.Value, error)

LTRIM returns the string value with whitespace stripped from the start only. @param {String} str - The string. @param {String} chars - Overrides the characters that should be removed from the string. It defaults to \r\n \t. @return {String} - The string without chars at the left-hand side.

func Left

func Left(_ context.Context, arg1, arg2 runtime.Value) (runtime.Value, error)

LEFT returns the leftmost characters of the string value by index. @param {String} str - The source string. @param {Int} length - The amount of characters to return. @return {String} - The leftmost characters of the string value by index.

func Like

func Like(_ context.Context, args ...runtime.Value) (runtime.Value, error)

LIKE checks whether the pattern search is contained in the string text, using wildcard matching. @param {String} str - The string to search in. @param {String} search - A search pattern that can contain the wildcard characters. @param {Boolean} caseInsensitive - If set to true, the matching will be case-insensitive. The default is false. @return {Boolean} - Returns true if the pattern is contained in text, and false otherwise.

func Lower

func Lower(_ context.Context, arg runtime.Value) (runtime.Value, error)

LOWER converts strings to their lower-case counterparts. All other characters are returned unchanged. @param {String} str - The source string. @return {String} - THis string in lower case.

func Md5

MD5 calculates the MD5 checksum for text and return it in a hexadecimal string representation. @param {String} str - The string to do calculations against to. @return {String} - MD5 checksum as hex string.

func RTrim

func RTrim(_ context.Context, args ...runtime.Value) (runtime.Value, error)

RTRIM returns the string value with whitespace stripped from the end only. @param {String} str - The string. @param {String} chars - Overrides the characters that should be removed from the string. It defaults to \r\n \t. @return {String} - The string without chars at the right-hand side.

func RandomToken

func RandomToken(_ context.Context, arg runtime.Value) (runtime.Value, error)

RANDOM_TOKEN generates a pseudo-random token string with the specified length. The algorithm for token generation should be treated as opaque. @param {Int} len - The desired string length for the token. It must be greater than 0 and at most 65536. @return {String} - A generated token consisting of lowercase letters, uppercase letters and numbers.

func RegexMatch

func RegexMatch(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

REGEX_MATCH returns the matches in the given string text, using the regex. @param {String} str - The string to search in. @param {String} expression - A regular expression to use for matching the text. @param {Boolean} caseInsensitive - If set to true, the matching will be case-insensitive. The default is false. @return {Any[]} - An array of strings containing the matches.

func RegexReplace

func RegexReplace(_ context.Context, args ...runtime.Value) (runtime.Value, error)

REGEX_REPLACE replace every substring matched with the regexp with a given string. @param {String} str - The string to split. @param {String} expression - A regular expression search pattern. @param {String} replacement - The string to replace the search pattern with @param {Boolean} [caseInsensitive=False] - If set to true, the matching will be case-insensitive. @return {String} - Returns the string text with the search regex pattern replaced with the replacement string wherever the pattern exists in text

func RegexSplit

func RegexSplit(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

REGEX_SPLIT splits the given string text into a list of strings, using the separator. @param {String} str - The string to split. @param {String} expression - A regular expression to use for splitting the text. @param {Boolean} caseInsensitive - If set to true, the matching will be case-insensitive. The default is false. @param {Int} limit - Limit the number of split values in the result. If no limit is given, the number of splits returned is not bounded. @return {Any[]} - An array of strings splitted by the expression.

func RegexTest

func RegexTest(_ context.Context, args ...runtime.Value) (runtime.Value, error)

REGEX_TEST test whether the regexp has at least one match in the given text. @param {String} str - The string to test. @param {String} expression - A regular expression to use for splitting the text. @param {Boolean} [caseInsensitive=False] - If set to true, the matching will be case-insensitive. @return {Boolean} - Returns true if the pattern is contained in text, and false otherwise.

func RegisterLib

func RegisterLib(ns runtime.Namespace)
func Right(_ context.Context, arg1, arg2 runtime.Value) (runtime.Value, error)

RIGHT returns the rightmost characters of the string value. @param {String} str - The source string. @param {Int} length - The amount of characters to return. @return {String} - The rightmost characters of the string value.

func Sha1

func Sha1(_ context.Context, arg runtime.Value) (runtime.Value, error)

SHA1 calculates the SHA1 checksum for text and returns it in a hexadecimal string representation. @param {String} str - The string to do calculations against to. @return {String} - Sha1 checksum as hex string.

func Sha512

func Sha512(_ context.Context, arg runtime.Value) (runtime.Value, error)

SHA512 calculates the SHA512 checksum for text and returns it in a hexadecimal string representation. @param {String} str - The string to do calculations against to. @return {String} - SHA512 checksum as hex string.

func Split

func Split(ctx context.Context, args ...runtime.Value) (runtime.Value, error)

SPLIT splits the given string value into a list of strings, using the separator. @param {String} str - The string to split. @param {String} separator - The separator. @param {Int} limit - Limit the number of split values in the result. If no limit is given, the number of splits returned is not bounded. @return {String[]} - arrayList of strings.

func Substitute

func Substitute(_ context.Context, args ...runtime.Value) (runtime.Value, error)

SUBSTITUTE replaces search values in the string value. @param {String} str - The string to modify @param {String} search - The string representing a search pattern @param {String} replace - The string representing a replace value @param {Int} limit - The cap the number of replacements to this value. @return {String} - Returns a string with replace substring.

func Substring

func Substring(_ context.Context, args ...runtime.Value) (runtime.Value, error)

SUBSTRING returns a substring of value. @param {String} str - The source string. @param {Int} offset - Start at offset, offsets start at position 0. @param {Int} [length] - At most length characters, omit to get the substring from offset to the end of the string. @return {String} - A substring of value.

func ToBase64

func ToBase64(_ context.Context, arg runtime.Value) (runtime.Value, error)

TO_BASE64 returns the base64 representation of value. @param {String} str - The string to encode. @return {String} - A base64 representation of the string.

func Trim

func Trim(_ context.Context, args ...runtime.Value) (runtime.Value, error)

TRIM returns the string value with whitespace stripped from the start and/or end. @param {String} str - The string. @param {String} chars - Overrides the characters that should be removed from the string. It defaults to \r\n \t. @return {String} - The string without chars on both sides.

func UnescapeHTML

func UnescapeHTML(_ context.Context, arg runtime.Value) (runtime.Value, error)

UNESCAPE_HTML unescapes entities like "&lt;" to become "<". It unescapes a larger range of entities than EscapeString escapes. For example, "&aacute;" unescapes to "á", as does "&#225;" and "&#xE1;". UnescapeString(EscapeString(s)) == s always holds, but the converse isn't always true. @param {String} uri - Uri to escape. @return {String} - Escaped string.

func Upper

func Upper(_ context.Context, arg runtime.Value) (runtime.Value, error)

UPPER converts strings to their upper-case counterparts. All other characters are returned unchanged. @param {String} str - The source string. @return {String} - THis string in upper case.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL