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 Type| Name | Type | Description |
$arg |
xs:string? |
the string to split |
| return value |
xs:string* |
XSLT Function Declaration| See XQuery definition. | | XSLT 2.0 Syntax: |
|---|
<xsl:function name="functx:chars" as="xs:string*"
xmlns:functx="http://www.functx.com" >
<xsl:param name="arg" as="xs:string?"/>
<xsl:sequence select="
for $ch in string-to-codepoints($arg)
return codepoints-to-string($ch)
"/>
</xsl:function>
|
Examples| XSLT Example | Results |
|---|
functx:chars('abc')
|
('a', 'b', 'c')
|
functx:chars('a b c')
|
('a', ' ', 'b', ' ', 'c')
|
See Also| fn:tokenize | Splits a string based on a regular expression |
History |
|