String functions
Manipulate strings.
array_buffer_to_string()
Converts utf-8 bytes into string.
array_buffer_to_string(arrayBuffer)
Arguments
arrayBuffer
(Array, ArrayBuffer, TypedArray)- The Array, ArrayBuffer or TypedArray to be converted.
Returns
- (String)
- The utf-8 encoded string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
See also
base64_decode()
Decodes a base64-encoded string into utf-8 encoded string.
base64_decode(string)
Arguments
string
(String)- The string to be decoded.
Returns
- (String)
- A utf-8 encoded string representation of decoded data.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
See also
base64_decode_binary()
Decodes a base64-encoded string into typed array (uint8).
base64_decode_binary(string)
Arguments
string
(String)- The string to be decoded.
Returns
- (TypedArray)
- A typed array (uint8) with decoded data.
Examples
TypedArray, can't be represented as JSON Array, to display result, use to_array
function.
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
base64_encode()
Creates a base64-encoded string from the input array or string.
base64_encode(data)
Arguments
data
(String | Array | ArrayBuffer | TypedArray)- Data to be encoded.
break
(Boolean)- (Optional) Break encoded string into 76 character lines.
Returns
- (String)
- The base64 encoded string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
base64_urlsafe_encode()
Creates a base64-encoded string from the input array or string, that is safe to use as url parameter.
base64_urlsafe_encode(data)
Arguments
data
(String | Array | ArrayBuffer | TypedArray)- Data to be encoded.
Returns
- (String)
- The base64 encoded string.
Examples
You can use a HTTP connector with Array buffer
response data type as a source.
Plug response output port and add following transformation.
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
camel_case()
Converts string
to camel case.
camel_case(string)
Arguments
string
(String)- The string to convert.
Returns
- (String)
- The camel cased string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
capitalize()
Converts the first character of string
to upper case and the remaining to lower case.
capitalize(string)
Arguments
string
(String)- The string to capitalize.
Returns
- (String)
- The capitalized string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
deburr()
Deburrs string
by converting Latin-1 Supplement and Latin Extended-A letters to basic Latin letters and removing combining diacritical marks.
deburr(string)
Arguments
string
(String)- The string to deburr.
Returns
- (String)
- The deburred string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
decode_uri_component()
Perform URL percent-decoding of input string
.
decode_uri_component(string)
Arguments
string
(String)- The string to decode.
Returns
- (String)
- The decoded string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
encode_uri_component()
Perform URL percent-encoding of input string
.
encode_uri_component(string)
Arguments
string
(String)- The string to encode.
Returns
- (String)
- The encoded string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
ends_with()
Checks if string
ends with the given target
string.
ends_with(string, target, [position])
Arguments
string
(String)- The string to inspect.
target
(String)- The string to search for.
position
(String)- (Optional) The position to search up to. Default value is
length(string)
.
Returns
- (Boolean)
- true if
string
ends withtarget
, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
escape()
Converts the characters &
, <
, >
, "
, and '
in string
to their corresponding HTML entities.
escape(string)
Arguments
string
(String)- The string to escape.
Returns
- (String)
- The escaped string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
regexp_escape()
Escapes the RegExp special characters ^
, $
, .
, *
, +
, ?
, (
, )
, [
, ]
, {
, }
, and |
in string
.
regexp_escape(string)
Arguments
string
(String)- The string to escape.
Returns
- (String)
- The escaped string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
kebab_case()
Converts string
to kebab case.
kebab_case(string)
Arguments
string
(String)- The string to convert.
Returns
- (String)
- The kebab cased string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
lower_case()
Converts string
, as space separated words, to lower case.
lower_case(string)
Arguments
string
(String)- The string to convert.
Returns
- (String)
- The lower cased string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
lower_first()
Converts the first character of string
to lower case.
lower_first(string)
Arguments
string
(String)- The string to convert.
Returns
- (String)
- The converted string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
match()
Returns an object with the result of matching a string against a regular expression.
match(string, pattern)
Arguments
string
(String)- The string against which to match the regular expression.
pattern
(RegExp)- A regular expression.
Returns
- (Object)
- Returns a match object. The object consists of the following properties:
match
- matched substring;namedMatches
- named matches if they are defined in the regular expression;matchStartIndex
- the start position of the match;matchEndIndex
- the end position of the match. No match is indicated by the emptymatch
property and the indexes values of -1.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
match_all()
Returns an array with all results matching a string against a regular expression.
match_all(string, pattern)
Arguments
string
(String)- The string against which to match the regular expression.
pattern
(RegExp)- A regular expression.
Returns
- (Array)
- Returns an array of matches or an empty array if no matches are found. Each match is an object with the following properties:
match
- matched substring;namedMatches
- named matches if they are defined in the regular expression;matchStartIndex
- the start position of the match;matchEndIndex
- the end position of the match.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
pad()
Pads string
on the left and right sides if it's shorter than length
. Padding characters are truncated if they can't be evenly divided by length
.
pad(string, [length], [chars])
Arguments
string
(String)- The string to pad.
length
(Number)- (Optional) The padding length. Default value is
0
. chars
(String)- (Optional) The string used as padding. Default value is "
Returns
- (String)
- The padded string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
pad_end()
Pads string
on the right side if it's shorter than length
. Padding characters are truncated if they exceed length
.
pad_end(string, [length], [chars])
Arguments
string
(String)- The string to pad.
length
(Number)- (Optional) The padding length. Default value is
0
. chars
(String)- (Optional) The string used as padding. Default value is "
Returns
- (String)
- The padded string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
pad_start()
Pads string
on the left side if it's shorter than length
. Padding characters are truncated if they exceed length
.
pad_start(string, [length], [chars])
Arguments
string
(String)- The string to pad.
length
(Number)- (Optional) The padding length. Default value is
0
. chars
(String)- (Optional) The string used as padding. Default value is "
Returns
- (String)
- The padded string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
parse_int()
Converts string
to an integer of the specified radix
. If radix
is undefined or 0, a radix
of 10 is used unless string
value is a hexadecimal, in which case a radix
of 16 is used.
parse_int(string, [radix])
Arguments
string
(String)- The string to convert.
radix
(Number)- (Optional) The radix to interpret value by. Default value is
10
.
Returns
- (Number)
- The converted integer.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
repeat()
Repeats the given string
n
times.
repeat(string, [n])
Arguments
string
(String)- The string to repeat.
radix
(Number)- (Optional) The number of times to repeat the string. Default value is
1
.
Returns
- (String)
- The repeated string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
replace()
Replaces the first match for pattern
in string
with replacement
.
replace(string, pattern, replacement)
Arguments
string
(String)- The string to modify.
pattern
(String | RegExp)- The pattern to replace.
replacement
(String | Expression)- The match replacement.
Returns
- (String)
- The modified string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
replace_all()
Replaces all matches for pattern
in string
with replacement
.
replace_all(string, pattern, replacement)
Arguments
string
(String)- The string to modify.
pattern
(String | RegExp)- The pattern to replace.
replacement
(String | Expression)- The match replacement.
Returns
- (String)
- The modified string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
search()
Executes a search for a match between pattern
and a specified string. Here pattern
can be both a regular expression or string.
search(string, pattern)
Arguments
string
(String)- The string against which to match the regular expression.
pattern
(String | RegExp)- A regular expression or string to search.
Returns
- (Number)
- The index of the first match or -1 if no match was found.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
See also
snake_case()
Converts string
to snake case.
snake_case(string)
Arguments
string
(String)- The string to convert.
Returns
- (String)
- The snake cased string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
split()
Splits string
by separator
.
split(string, separator, [limit])
Arguments
string
(String)- The string to split.
separator
(String | RegExp)- The separator pattern to split by.
limit
(Number)- (Optional) The length to truncate the resulting array to. Default value is
Infinity
.
Returns
- (Array)
- The string segments.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
string_to_array_buffer()
Converts string into typed array (uint8) with utf-8 bytes.
string_to_array_buffer(string)
Arguments
string
(String)- The string to be converted.
Returns
- (TypedArray)
- The typed array (uint8) with utf-8 bytes.
Examples
TypedArray, can't be represented as JSON Array, to display result, use to_array
function.
Input | Expression | Result |
---|---|---|
|
|
|
See also
substring()
Extracts a substring of string
from start
char up to, but not including end
char'
substring(string, [start], [end])
Arguments
Returns
- (Surbstrng)
- A substring of source string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
start_case()
Converts string
to start case.
start_case(string)
Arguments
string
(String)- The string to convert.
Returns
- (String)
- The start cased string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
starts_with()
Checks if string
starts with the given target
string.
starts_with(string, target, [position])
Arguments
string
(String)- The string to inspect.
target
(String)- The string to search for.
position
(Number)- (Optional) The position to search from. Default value is
0
.
Returns
- (Boolean)
- true if
string
starts withtarget
, else false.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
template()
Compiles and executes template
that can interpolate data
properties or expressions. data
properties may be accessed as free variables and placed as text in between double curly braces in the template. KelpQL finds the property matching the text in the data
object and replaces the text with the property value or the result of expression evaluation.
template(string, [data])
Arguments
string
(String)- The template string.
data
(Object | Expression)- (Optional) The data object. Default value is
{}
.
Returns
- (String)
- The interpolated template string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
regexp_test()
Tests if there is a match between a regular expression and a specified string.
regexp_test(pattern, string)
Arguments
string
(String)- The string against which to match the regular expression.
pattern
(RegExp)- A regular expression.
Returns
- (Boolean)
- Returns
true
if there is a match between the regular expression and the string. Otherwise,false
.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
See also
to_lower()
Converts string
, as a whole, to lower case.
to_lower(string)
Arguments
string
(String)- The string to convert.
Returns
- (String)
- The lower cased string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
to_upper()
Converts string
, as a whole, to upper case.
to_upper(string)
Arguments
string
(String)- The string to convert.
Returns
- (String)
- The upper cased string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
trim()
Removes leading and trailing whitespace or specified characters from string
.
trim(string, [chars])
Arguments
string
(String)- The string to trim.
chars
(String)- (Optional) The characters to trim. Default value is whitespace characters (RegExp
\s
).
Returns
- (String)
- The trimmed string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
trim_end()
Removes trailing whitespace or specified characters from string
.
trim_end(string, [chars])
Arguments
string
(String)- The string to trim.
chars
(String)- (Optional) The characters to trim. Default value is whitespace characters (RegExp
\s
).
Returns
- (String)
- The trimmed string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
trim_start()
Removes leading whitespace or specified characters from string
.
trim_start(string, [chars])
Arguments
string
(String)- The string to trim.
chars
(String)- (Optional) The characters to trim. Default value is whitespace characters (RegExp
\s
).
Returns
- (String)
- The trimmed string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
truncate()
Truncates string
if it's longer than the given maximum string length
. The last characters of the truncated string are replaced with the omission
string which defaults to ...
.
truncate(string, [options])
Arguments
string
(String)- The string to truncate.
options
(Object)(Optional) The options object. Default value is
{"length": 30, "omission": "..."}
.options.length
(Number) - The maximum string length. Default value is30
.options.omission
(String) - The string to indicate text is omitted. Default value is...
.options.separator
(String | RegExp) - The separator pattern to truncate to.
Returns
- (String)
- The truncated string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
unescape()
The inverse of escape(); this function converts the HTML entities &
, <
, >
, "
, and '
in string
to their corresponding characters.
unescape(string)
Arguments
string
(String)- The string to unescape.
Returns
- (String)
- The unescaped string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
upper_case()
Converts string
, as space separated words, to upper case.
upper_case(string)
Arguments
string
(String)- The string to convert.
Returns
- (String)
- The upper cased string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
|
|
|
upper_first()
Converts the first character of string
to upper case.
upper_first(string)
Arguments
string
(String)- The string to convert.
Returns
- (String)
- The converted string.
Examples
Input | Expression | Result |
---|---|---|
|
|
|
|
|
|
words()
Splits a specified string into an array of its words.
words(string)
Arguments
string
(String)- The string to split.
Returns
- (Array)
- The words of
string
.
Examples
Input | Expression | Result |
---|---|---|
|
|
|