Learn how to use and combine different string functions in APL
Function Name | Description |
---|---|
base64_encode_tostring() | Encodes a string as base64 string. |
base64_decode_tostring() | Decodes a base64 string to a UTF-8 string. |
countof() | Counts occurrences of a substring in a string. |
countof_regex() | Counts occurrences of a substring in a string. Regex matches don’t. |
coalesce() | Evaluates a list of expressions and returns the first non-null (or non-empty for string) expression. |
extract() | Get a match for a regular expression from a text string. |
extract_all() | Get all matches for a regular expression from a text string. |
format_bytes() | Formats a number of bytes as a string including bytes units |
format_url() | Formats an input string into a valid URL by adding the necessary protocol if it’s escaping illegal URL characters. |
indexof() | Function reports the zero-based index of the first occurrence of a specified string within input string. |
isempty() | Returns true if the argument is an empty string or is null. |
isnotempty() | Returns true if the argument isn’t an empty string or a null. |
isnotnull() | Returns true if the argument is not null. |
isnull() | Evaluates its sole argument and returns a bool value indicating if the argument evaluates to a null value. |
parse_bytes() | Parses a string including byte size units and returns the number of bytes |
parse_json() | Interprets a string as a JSON value) and returns the value as dynamic. |
parse_url() | Parses an absolute URL string and returns a dynamic object contains all parts of the URL. |
parse_urlquery() | Parses a url query string and returns a dynamic object contains the Query parameters. |
replace() | Replace all regex matches with another string. |
replace_regex() | Replaces all regex matches with another string. |
replace_string() | Replaces all string matches with another string. |
reverse() | Function makes reverse of input string. |
split() | Splits a given string according to a given delimiter and returns a string array with the contained substrings. |
strcat() | Concatenates between 1 and 64 arguments. |
strcat_delim() | Concatenates between 2 and 64 arguments, with delimiter, provided as first argument. |
strcmp() | Compares two strings. |
strlen() | Returns the length, in characters, of the input string. |
strrep() | Repeats given string provided number of times (default = 1). |
substring() | Extracts a substring from a source string starting from some index to the end of the string. |
toupper() | Converts a string to upper case. |
tolower() | Converts a string to lower case. |
trim() | Removes all leading and trailing matches of the specified cutset. |
trim_regex() | Removes all leading and trailing matches of the specified regular expression. |
trim_end() | Removes trailing match of the specified cutset. |
trim_end_regex() | Removes trailing match of the specified regular expression. |
trim_start() | Removes leading match of the specified cutset. |
trim_start_regex() | Removes leading match of the specified regular expression. |
url_decode() | The function converts encoded URL into a regular URL representation. |
url_encode() | The function converts characters of the input URL into a format that can be transmitted over the Internet. |
gettype() | Returns the runtime type of its single argument. |
parse_csv() | Splits a given string representing a single record of comma-separated values and returns a string array with these values. |
Each argument has a required section which is denoted with required
or optional
required
it means the argument must be passed into that function before it’ll work.optional
it means the function can work without passing the argument value.Encodes a string as base64 string.
Name | Type | Required or Optional | Description |
---|---|---|---|
String | string | Required | Input string or string field to be encoded as base64 string. |
Returns the string encoded as base64 string.
Decodes a base64 string to a UTF-8 string.
Name | Type | Required or Optional | Description |
---|---|---|---|
String | string | Required | Input string or string field to be decoded from base64 to UTF8-8 string. |
Returns UTF-8 string decoded from base64 string.
Counts occurrences of a substring in a string.
name | type | description | Required or Optional |
---|---|---|---|
text source | string | Source to count your occurences from | Required |
search | string | The plain string to match inside source. | Required |
The number of times that the search string can be matched.
Counts occurrences of a substring in a string. regex matches don’t.
The number of times that the search string can be matched in the dataset. Regex matches do not.
Evaluates a list of expressions and returns the first non-null (or non-empty for string) expression.
name | type | description | Required or Optional |
---|---|---|---|
arguments | scalar | The expression or field to be evaluated. | Required |
The value of the first argument whose value isn’t null (or not-empty for string expressions).
Retrieve the first substring matching a regular expression from a source string.
name | type | description |
---|---|---|
regex | expression | A regular expression. |
captureGroup | int | A positive int constant indicating the capture group to extract. 0 stands for the entire match, 1 for the value matched by the first ’(‘parenthesis’)’ in the regular expression, 2 or more for subsequent parentheses. |
source | string | A string to search |
If regex finds a match in source: the substring matched against the indicated capture group captureGroup, optionally converted to typeLiteral.
If there’s no match, or the type conversion fails: -1
or string error
Retrieve all substrings matching a regular expression from a source string. Optionally, retrieve only a subset of the matching groups.
name | type | description | Required or Optional |
---|---|---|---|
regex | expression | A regular expression containing between one and 16 capture groups. Examples of a valid regex: @”(\d+)”. Examples of an invalid regex: @“\d+“ | Required |
captureGroups | array | A dynamic array constant that indicates the capture group to extract. Valid values are from 1 to the number of capturing groups in the regular expression. | optional |
source | string | A string to search | Required |
-1
Formats a number as a string representing data size in bytes.
name | type | description | Required or Optional |
---|---|---|---|
value | number | a number to be formatted as data size in bytes | Required |
precision | number | Number of digits the value will be rounded to. (default value is zero) | Optional |
units | string | Units of the target data size the string formatting will use (base 2 suffixes: Bytes , KiB , KB , MiB , MB , GiB , GB , TiB , TB , PiB , EiB , ZiB , YiB ; base 10 suffixes: kB MB GB TB PB EB ZB YB ). If the parameter is empty the units will be auto-selected based on input value. | Optional |
base | number | Either 2 or 10 to specify whether the prefix is calculated using 1000s or 1024s for each type. (default value is 2) | Optional |
Formats an input string into a valid URL. This function will return a string that is a properly formatted URL.
name | type | description | Required or Optional |
---|---|---|---|
url | dynamic | string input you want to format into a URL | Required |
format_url
function: scheme, host, port, fragment, user, password, query.Reports the zero-based index of the first occurrence of a specified string within the input string.
name | type | description | usage |
---|---|---|---|
source | string | Input string | Required |
lookup | string | String to look up | Required |
start_index | text | Search start position. | Optional |
length | characters | Number of character positions to examine. A value of -1 means unlimited length. | Optional |
occurrence | number | The number of the occurrence. Default 1. | Optional |
Zero-based index position of lookup.
Returns -1 if the string isn’t found in the input.
Returns true
if the argument is an empty string or is null.
Indicates whether the argument is an empty string or isnull.
Returns true
if the argument isn’t an empty string, and it isn’t null.
Returns true
if the argument is not null.
Evaluates its sole argument and returns a bool value indicating if the argument evaluates to a null value.
True or false, depending on whether or not the value is null.
Parses a string including byte size units and returns the number of bytes
name | type | description | Required or Optional |
---|---|---|---|
bytes_string | string | A string formated defining the number of bytes | Required |
base | number | (optional) Either 2 or 10 to specify whether the prefix is calculated using 1000s or 1024s for each type. (default value is 2) | Required |
Interprets a string as a JSON value and returns the value as dynamic.
Name | Type | Required or Optional | Description |
---|---|---|---|
Json Expr | string | Required | Expression that will be used, also represents a JSON-formatted value |
An object of type json that is determined by the value of json:
If json is of type string, and is a properly formatted JSON string, then the string is parsed, and the value produced is returned.
If json is of type string, but it isn’t a properly formatted JSON string, then the returned value is an object of type dynamic that holds the original string value.
Parses an absolute URL string
and returns an object contains URL parts.
Name | Type | Required or Optional | Description |
---|---|---|---|
URL | string | Required | A string represents a URL or the query part of the URL. |
An object of type dynamic that included the URL components: Scheme, Host, Port, Path, Username, Password, Query Parameters, Fragment.
Returns a dynamic
object contains the Query parameters.
Name | Type | Required or Optional | Description |
---|---|---|---|
Query | string | Required | A string represents a url query. |
query: A string represents a url query
An object of type dynamic that includes the query parameters.
Replace all regex matches with another string.
Replaces all regex matches with another string.
source after replacing all matches of regex with evaluations of rewrite. Matches do not overlap.
Backreferences match the same text as previously matched by a capturing group. With Backreferences, you can identify a repeated character or substring within a string.
$
sign.Replaces all string matches with another string.
Name | Type | Required or Optional | Description |
---|---|---|---|
lookup | string | Required | A string which Axiom matches in text and replaces with rewrite . |
rewrite | string | Required | A string with which Axiom replaces parts of text that match lookup . |
text | string | Required | A string where Axiom replaces parts matching lookup with rewrite . |
text
after replacing all matches of lookup
with evaluations of rewrite
. Matches don’t overlap.
Function reverses the order of the input Field.
name | type | description | Required or Optional |
---|---|---|---|
Field | string | Field input value | Required |
The reverse order of a field value.
Splits a given string according to a given delimiter and returns a string array with the contained substrings.
Optionally, a specific substring can be returned if exists.
Concatenates between 1 and 64 arguments.
If the arguments aren’t of string type, they’ll be forcibly converted to string.
Name | Type | Required or Optional | Description |
---|---|---|---|
Expr | string | Required | Expressions to be concatenated. |
Arguments, concatenated to a single string.
Concatenates between 2 and 64 arguments, with delimiter, provided as first argument.
Name | Type | Required or Optional | Description |
---|---|---|---|
delimiter | string | Required | string expression, which will be used as separator. |
argument1 .. | string | Required | Expressions to be concatenated. |
Arguments, concatenated to a single string with delimiter.
Compares two strings.
The function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ or until the end of shorter string is reached.
Name | Type | Required or Optional | Description |
---|---|---|---|
string1 | string | Required | first input string for comparison. |
string2 | string | Required | second input string for comparison. |
Returns an integral value indicating the relationship between the strings:
Returns the length, in characters, of the input string.
Name | Type | Required or Optional | Description |
---|---|---|---|
source | string | Required | The source string that will be measured for string length. |
Returns the length, in characters, of the input string.
Repeats given string provided amount of times.
Name | Type | Required or Optional | Description |
---|---|---|---|
value | Expr | Required | Inpute Expression |
multiplier | integer | Required | positive integer value (from 1 to 1024) |
delimiter | string | Optional | An optional string expression (default: empty string) |
Value repeated for a specified number of times, concatenated with delimiter.
In case if multiplier is more than maximal allowed value (1024), input string will be repeated 1024 times.
Extracts a substring from a source string starting from some index to the end of the string.
A substring from the given string. The substring starts at startingIndex (zero-based) character position and continues to the end of the string or length characters if specified.
Converts a string to upper case.
Converts a string to lower case.
Removes all leading and trailing matches of the specified cutset.
source after trimming matches of the cutset found in the beginning and/or the end of source.
Removes all leading and trailing matches of the specified regular expression.
source after trimming matches of regex found in the beginning and/or the end of source.
Removes trailing match of the specified cutset.
source after trimming matches of the cutset found in the end of source.
Removes trailing match of the specified regular expression.
source after trimming matches of regex found in the end of source.
Removes leading match of the specified cutset.
Removes leading match of the specified regular expression.
source after trimming match of regex found in the beginning of source.
The function converts encoded URL into a to regular URL representation.
encoded url:
encoded URL (string).URL (string) in a regular representation.
The function converts characters of the input URL into a format that can be transmitted over the Internet.
URL (string) converted into a format that can be transmitted over the Internet.
Returns the runtime type of its single argument.
A string representing the runtime type of its single argument.
Expression | Returns |
---|---|
gettype(“lima”) | string |
gettype(2222) | int |
gettype(5==5) | bool |
gettype(now()) | datetime |
gettype(parse_json(‘67’)) | int |
gettype(parse_json(’ “polish” ‘)) | string |
gettype(parse_json(’ {“axiom”:1234} ‘)) | dictionary |
gettype(parse_json(’ [6, 7, 8] ‘)) | array |
gettype(456.98) | real |
gettype(parse_json(”)) | null |
Splits a given string representing a single record of comma-separated values and returns a string array with these values.
A string array that contains the split values.
Learn how to use and combine different string functions in APL
Function Name | Description |
---|---|
base64_encode_tostring() | Encodes a string as base64 string. |
base64_decode_tostring() | Decodes a base64 string to a UTF-8 string. |
countof() | Counts occurrences of a substring in a string. |
countof_regex() | Counts occurrences of a substring in a string. Regex matches don’t. |
coalesce() | Evaluates a list of expressions and returns the first non-null (or non-empty for string) expression. |
extract() | Get a match for a regular expression from a text string. |
extract_all() | Get all matches for a regular expression from a text string. |
format_bytes() | Formats a number of bytes as a string including bytes units |
format_url() | Formats an input string into a valid URL by adding the necessary protocol if it’s escaping illegal URL characters. |
indexof() | Function reports the zero-based index of the first occurrence of a specified string within input string. |
isempty() | Returns true if the argument is an empty string or is null. |
isnotempty() | Returns true if the argument isn’t an empty string or a null. |
isnotnull() | Returns true if the argument is not null. |
isnull() | Evaluates its sole argument and returns a bool value indicating if the argument evaluates to a null value. |
parse_bytes() | Parses a string including byte size units and returns the number of bytes |
parse_json() | Interprets a string as a JSON value) and returns the value as dynamic. |
parse_url() | Parses an absolute URL string and returns a dynamic object contains all parts of the URL. |
parse_urlquery() | Parses a url query string and returns a dynamic object contains the Query parameters. |
replace() | Replace all regex matches with another string. |
replace_regex() | Replaces all regex matches with another string. |
replace_string() | Replaces all string matches with another string. |
reverse() | Function makes reverse of input string. |
split() | Splits a given string according to a given delimiter and returns a string array with the contained substrings. |
strcat() | Concatenates between 1 and 64 arguments. |
strcat_delim() | Concatenates between 2 and 64 arguments, with delimiter, provided as first argument. |
strcmp() | Compares two strings. |
strlen() | Returns the length, in characters, of the input string. |
strrep() | Repeats given string provided number of times (default = 1). |
substring() | Extracts a substring from a source string starting from some index to the end of the string. |
toupper() | Converts a string to upper case. |
tolower() | Converts a string to lower case. |
trim() | Removes all leading and trailing matches of the specified cutset. |
trim_regex() | Removes all leading and trailing matches of the specified regular expression. |
trim_end() | Removes trailing match of the specified cutset. |
trim_end_regex() | Removes trailing match of the specified regular expression. |
trim_start() | Removes leading match of the specified cutset. |
trim_start_regex() | Removes leading match of the specified regular expression. |
url_decode() | The function converts encoded URL into a regular URL representation. |
url_encode() | The function converts characters of the input URL into a format that can be transmitted over the Internet. |
gettype() | Returns the runtime type of its single argument. |
parse_csv() | Splits a given string representing a single record of comma-separated values and returns a string array with these values. |
Each argument has a required section which is denoted with required
or optional
required
it means the argument must be passed into that function before it’ll work.optional
it means the function can work without passing the argument value.Encodes a string as base64 string.
Name | Type | Required or Optional | Description |
---|---|---|---|
String | string | Required | Input string or string field to be encoded as base64 string. |
Returns the string encoded as base64 string.
Decodes a base64 string to a UTF-8 string.
Name | Type | Required or Optional | Description |
---|---|---|---|
String | string | Required | Input string or string field to be decoded from base64 to UTF8-8 string. |
Returns UTF-8 string decoded from base64 string.
Counts occurrences of a substring in a string.
name | type | description | Required or Optional |
---|---|---|---|
text source | string | Source to count your occurences from | Required |
search | string | The plain string to match inside source. | Required |
The number of times that the search string can be matched.
Counts occurrences of a substring in a string. regex matches don’t.
The number of times that the search string can be matched in the dataset. Regex matches do not.
Evaluates a list of expressions and returns the first non-null (or non-empty for string) expression.
name | type | description | Required or Optional |
---|---|---|---|
arguments | scalar | The expression or field to be evaluated. | Required |
The value of the first argument whose value isn’t null (or not-empty for string expressions).
Retrieve the first substring matching a regular expression from a source string.
name | type | description |
---|---|---|
regex | expression | A regular expression. |
captureGroup | int | A positive int constant indicating the capture group to extract. 0 stands for the entire match, 1 for the value matched by the first ’(‘parenthesis’)’ in the regular expression, 2 or more for subsequent parentheses. |
source | string | A string to search |
If regex finds a match in source: the substring matched against the indicated capture group captureGroup, optionally converted to typeLiteral.
If there’s no match, or the type conversion fails: -1
or string error
Retrieve all substrings matching a regular expression from a source string. Optionally, retrieve only a subset of the matching groups.
name | type | description | Required or Optional |
---|---|---|---|
regex | expression | A regular expression containing between one and 16 capture groups. Examples of a valid regex: @”(\d+)”. Examples of an invalid regex: @“\d+“ | Required |
captureGroups | array | A dynamic array constant that indicates the capture group to extract. Valid values are from 1 to the number of capturing groups in the regular expression. | optional |
source | string | A string to search | Required |
-1
Formats a number as a string representing data size in bytes.
name | type | description | Required or Optional |
---|---|---|---|
value | number | a number to be formatted as data size in bytes | Required |
precision | number | Number of digits the value will be rounded to. (default value is zero) | Optional |
units | string | Units of the target data size the string formatting will use (base 2 suffixes: Bytes , KiB , KB , MiB , MB , GiB , GB , TiB , TB , PiB , EiB , ZiB , YiB ; base 10 suffixes: kB MB GB TB PB EB ZB YB ). If the parameter is empty the units will be auto-selected based on input value. | Optional |
base | number | Either 2 or 10 to specify whether the prefix is calculated using 1000s or 1024s for each type. (default value is 2) | Optional |
Formats an input string into a valid URL. This function will return a string that is a properly formatted URL.
name | type | description | Required or Optional |
---|---|---|---|
url | dynamic | string input you want to format into a URL | Required |
format_url
function: scheme, host, port, fragment, user, password, query.Reports the zero-based index of the first occurrence of a specified string within the input string.
name | type | description | usage |
---|---|---|---|
source | string | Input string | Required |
lookup | string | String to look up | Required |
start_index | text | Search start position. | Optional |
length | characters | Number of character positions to examine. A value of -1 means unlimited length. | Optional |
occurrence | number | The number of the occurrence. Default 1. | Optional |
Zero-based index position of lookup.
Returns -1 if the string isn’t found in the input.
Returns true
if the argument is an empty string or is null.
Indicates whether the argument is an empty string or isnull.
Returns true
if the argument isn’t an empty string, and it isn’t null.
Returns true
if the argument is not null.
Evaluates its sole argument and returns a bool value indicating if the argument evaluates to a null value.
True or false, depending on whether or not the value is null.
Parses a string including byte size units and returns the number of bytes
name | type | description | Required or Optional |
---|---|---|---|
bytes_string | string | A string formated defining the number of bytes | Required |
base | number | (optional) Either 2 or 10 to specify whether the prefix is calculated using 1000s or 1024s for each type. (default value is 2) | Required |
Interprets a string as a JSON value and returns the value as dynamic.
Name | Type | Required or Optional | Description |
---|---|---|---|
Json Expr | string | Required | Expression that will be used, also represents a JSON-formatted value |
An object of type json that is determined by the value of json:
If json is of type string, and is a properly formatted JSON string, then the string is parsed, and the value produced is returned.
If json is of type string, but it isn’t a properly formatted JSON string, then the returned value is an object of type dynamic that holds the original string value.
Parses an absolute URL string
and returns an object contains URL parts.
Name | Type | Required or Optional | Description |
---|---|---|---|
URL | string | Required | A string represents a URL or the query part of the URL. |
An object of type dynamic that included the URL components: Scheme, Host, Port, Path, Username, Password, Query Parameters, Fragment.
Returns a dynamic
object contains the Query parameters.
Name | Type | Required or Optional | Description |
---|---|---|---|
Query | string | Required | A string represents a url query. |
query: A string represents a url query
An object of type dynamic that includes the query parameters.
Replace all regex matches with another string.
Replaces all regex matches with another string.
source after replacing all matches of regex with evaluations of rewrite. Matches do not overlap.
Backreferences match the same text as previously matched by a capturing group. With Backreferences, you can identify a repeated character or substring within a string.
$
sign.Replaces all string matches with another string.
Name | Type | Required or Optional | Description |
---|---|---|---|
lookup | string | Required | A string which Axiom matches in text and replaces with rewrite . |
rewrite | string | Required | A string with which Axiom replaces parts of text that match lookup . |
text | string | Required | A string where Axiom replaces parts matching lookup with rewrite . |
text
after replacing all matches of lookup
with evaluations of rewrite
. Matches don’t overlap.
Function reverses the order of the input Field.
name | type | description | Required or Optional |
---|---|---|---|
Field | string | Field input value | Required |
The reverse order of a field value.
Splits a given string according to a given delimiter and returns a string array with the contained substrings.
Optionally, a specific substring can be returned if exists.
Concatenates between 1 and 64 arguments.
If the arguments aren’t of string type, they’ll be forcibly converted to string.
Name | Type | Required or Optional | Description |
---|---|---|---|
Expr | string | Required | Expressions to be concatenated. |
Arguments, concatenated to a single string.
Concatenates between 2 and 64 arguments, with delimiter, provided as first argument.
Name | Type | Required or Optional | Description |
---|---|---|---|
delimiter | string | Required | string expression, which will be used as separator. |
argument1 .. | string | Required | Expressions to be concatenated. |
Arguments, concatenated to a single string with delimiter.
Compares two strings.
The function starts comparing the first character of each string. If they are equal to each other, it continues with the following pairs until the characters differ or until the end of shorter string is reached.
Name | Type | Required or Optional | Description |
---|---|---|---|
string1 | string | Required | first input string for comparison. |
string2 | string | Required | second input string for comparison. |
Returns an integral value indicating the relationship between the strings:
Returns the length, in characters, of the input string.
Name | Type | Required or Optional | Description |
---|---|---|---|
source | string | Required | The source string that will be measured for string length. |
Returns the length, in characters, of the input string.
Repeats given string provided amount of times.
Name | Type | Required or Optional | Description |
---|---|---|---|
value | Expr | Required | Inpute Expression |
multiplier | integer | Required | positive integer value (from 1 to 1024) |
delimiter | string | Optional | An optional string expression (default: empty string) |
Value repeated for a specified number of times, concatenated with delimiter.
In case if multiplier is more than maximal allowed value (1024), input string will be repeated 1024 times.
Extracts a substring from a source string starting from some index to the end of the string.
A substring from the given string. The substring starts at startingIndex (zero-based) character position and continues to the end of the string or length characters if specified.
Converts a string to upper case.
Converts a string to lower case.
Removes all leading and trailing matches of the specified cutset.
source after trimming matches of the cutset found in the beginning and/or the end of source.
Removes all leading and trailing matches of the specified regular expression.
source after trimming matches of regex found in the beginning and/or the end of source.
Removes trailing match of the specified cutset.
source after trimming matches of the cutset found in the end of source.
Removes trailing match of the specified regular expression.
source after trimming matches of regex found in the end of source.
Removes leading match of the specified cutset.
Removes leading match of the specified regular expression.
source after trimming match of regex found in the beginning of source.
The function converts encoded URL into a to regular URL representation.
encoded url:
encoded URL (string).URL (string) in a regular representation.
The function converts characters of the input URL into a format that can be transmitted over the Internet.
URL (string) converted into a format that can be transmitted over the Internet.
Returns the runtime type of its single argument.
A string representing the runtime type of its single argument.
Expression | Returns |
---|---|
gettype(“lima”) | string |
gettype(2222) | int |
gettype(5==5) | bool |
gettype(now()) | datetime |
gettype(parse_json(‘67’)) | int |
gettype(parse_json(’ “polish” ‘)) | string |
gettype(parse_json(’ {“axiom”:1234} ‘)) | dictionary |
gettype(parse_json(’ [6, 7, 8] ‘)) | array |
gettype(456.98) | real |
gettype(parse_json(”)) | null |
Splits a given string representing a single record of comma-separated values and returns a string array with these values.
A string array that contains the split values.