Description
The functx:chars function splits a string into individual characters and returns them as a sequence of strings of length 1 each.
Arguments and Return TypeName | Type | Description |
$arg |
xs:string? |
the string to split |
return value |
xs:string* |
XQuery Function DeclarationSee XSLT definition. | declare namespace functx = "http://www.functx.com";
declare function functx:chars
( $arg as xs:string? ) as xs:string* {
for $ch in string-to-codepoints($arg)
return codepoints-to-string($ch)
} ; |
ExamplesXQuery Example | Results |
---|
functx:chars('abc') |
('a', 'b', 'c') |
functx:chars('a b c') |
('a', ' ', 'b', ' ', 'c') |
See Alsofn:tokenize | Splits a string based on a regular expression |
History |
Recommended Reading:
|