This module provides string related functions.
Mostly, the functions in this module provide primitives to work with streamable strings. For example, it allows to check whether a given string is streamable or seekable.
fn:analyze-string
but returns a JSON array rather than an XML element.
$input
were a zero-length string.fn:matches
function.match
or non-match
. For non-match
, the value is a string that is the part of $input
that did not match; for match
, the value is either a string that is the part of $input
that matched (when $pattern
contains no capturing groups) or an array containing values for both capturing groups and other matches. Capturing group matches are themselves arrays where the first element is the group number (1-based) and subsequent elements are either a string that is the part of $input
that matched or sub-arrays for nested capturing groups.fn:analyze-string
but returns a JSON array rather than an XML element.
$input
were a zero-length string.match
or non-match
. For non-match
, the value is a string that is the part of $input
that did not match; for match
, the value is either a string that is the part of $input
that matched (when $pattern
contains no capturing groups) or an array containing values for both capturing groups and other matches. Capturing group matches are themselves arrays where the first element is the group number (1-based) and subsequent elements are either a string that is the part of $input
that matched or sub-arrays for nested capturing groups.This function materializes a streamable string.
The drawback of a streamable (non-seekable) string is that its value can only be consumed once. That is, only one function can access the value of astreamable string item.
In order to remedy this situation, this function can be used to convert a streamable string into its non-streamable counterpart. As a result, the string returned by this function has the same value as its input but is materialized and, hence, can be consumed multiple times.
This function checks whether a given string item is implemented by a streamable string.
A streamable string is produced by some functions of a module. It's an optimized implementation of an string to handle arbitrary sized data. The drawback is that its value can only be consumed once. That is, only one function can access the value of a streamable string item.
This function checks whether a given string item is a seekable stream string.
For example, a seekable streamable string is returned by the file module.
Returns a sequence of strings constructed by splitting the input wherever the given separator is found.
The function is different from tokenize. It doesn't allow the separator to be a regular expression. This restriction allows for more performant implementation. Specifically, the function processes streamable strings as input in a streamable way which is particularly useful to tokenize huge strings.