String Functions

String functions build, inspect, compare, and transform character strings, including regular-expression matching, splitting, and replacement.
codepoints-to-string((66, 65, 67, 72))BACH
string-to-codepoints("BACH")(66, 65, 67, 72)
compare("ABC","AAB")1
codepoint-equal("ABC","ABC ")false
concat("AB","CD")ABCD
"AB"||"CD"ABCD
string-join(('A','B','C'),'-')A-B-C
substring("ABCDE",2,3)BCD
string-length("ABCDE")5
normalize-space('A B C')A B C
normalize-unicode('ABC')ABC
upper-case('Abc')ABC
lower-case('Abc')abc
translate("bar","abc","ABC")BAr
contains("ABCDE","CD")true
starts-with("ABCDE","ABC")true
ends-with("ABCDE","cde")true
substring-before("ABCDE","CDE")AB
substring-after("ABCDE","B")CDE
matches("ABCDE","^A.C.E$")true
replace("abracadabra", "bra", "*")a*cada*
tokenize("AB,CD,E",",")('AB','CD','E')

analyze-string("The cat sat on the mat.", "\w+") matches every run of word characters against the non-matching text around it, and returns:
<analyze-string-result xmlns="http://www.w3.org/2005/xpath-functions">
  <match>The</match>
  <non-match> </non-match>
  <match>cat</match>
  <non-match> </non-match>
  <match>sat</match>
  <non-match> </non-match>
  <match>on</match>
  <non-match> </non-match>
  <match>the</match>
  <non-match> </non-match>
  <match>mat</match>
  <non-match>.</non-match>
</analyze-string-result>

ch03-string-functions.xpath.txt:
analyze-string("The cat sat on the mat.", "\w+")

The cat sat on the mat .