xdmp:
cts:
math:
prof:
dbg:
sec:
thsr:
:
trgr:
cpf:
lnk:
dom:
p:
cvt:
msword:
excel:
ppt:
pdf:
dbk:
css:
xhtml:
fn:
The string built-in functions are XQuery functions defined to operate on string values. They are defined in XQuery 1.0 and XPath 2.0 Functions and Operators.
The string built-in functions use the fn namespace prefix, which is predefined in the server. Also, the fn prefix is the default prefix for function calls if none is specified.
fn
Returns true if the specified parameters are the same Unicode code point, otherwise returns false. The codepoints are compared according to the Unicode code point collation (http://www.w3.org/2005/xpath-functions/collation/codepoint).
true
false
If either argument is the empty sequence, the result is the empty sequence.
let $cp := fn:string-to-codepoints("123456") return fn:codepoint-equal("123456", fn:codepoints-to-string($cp) ) => true
xs:string
Returns -1, 0, or 1, depending on whether the value of the $comparand1 is respectively less than, equal to, or greater than the value of $comparand2, according to the rules of the collation that is used.
fn:compare("hello", "goodbye") => 1
Returns the xs:string that is the concatenation of the values of the specified parameters. Accepts two or more xdt:anyAtomicType arguments and casts them to xs:string. If any of the parameters is the empty sequence, the parameter is treated as the zero-length string.
xdt:anyAtomicType
fn:concat("a", "b", "c") => abc
fn:contains("this is a string", "s a s") => true
fn:encode-for-uri("http://example.com/Weather/Los%20Angeles#ocean") => "http%3A%2F%2Fexample.com%2FWeather%2FLos%2520Angeles%23ocean"
fn:ends-with("this is a string", "a string") => true
fn:escape-html-uri("http://example.com/Weather/Los Angeles#ocean") => "http://example.com/Weather/Los Angeles#ocean"
fn:escape-uri("http://developer.marklogic.com", fn:true()) => http%3A%2F%2Fdeveloper.marklogic.com fn:escape-uri("http://developer.marklogic.com", fn:false()) => http://developer.marklogic.com
fn:iri-to-uri("http://example.com/Weather/Los%20Angeles#ocean") => "http://example.com/Weather/Los%20Angeles#ocean"
fn:lower-case("aBCD") => abcd
fn:matches("this is a string", "is") => true fn:matches("this is a string", "zoo") => false
fn:normalize-space(" this is a string ") => this is a string
fn:replace("this is a string", "this", "that") -> that is a string
fn:starts-with("abcd", "ab") => true
Returns an xs:string created by concatenating the members of the $parameter1 sequence using $parameter2 as a separator. If the value of $arg2 is the zero-length string, then the members of $parameter1 are concatenated without a separator.
If the value of $parameter1 is the empty sequence, the zero-length string is returned.
fn:string-join(("hello", "goodbye"), " and ") => hello and goodbye
let $string := "this is a string" return fn:string-join(fn:tokenize($string, " "), "-") => this-is-a-string
fn:string-length("12345") => 5
fn:string-pad("abc", 3) => abcabcabc
Returns the sequence of Unicode code points that constitute an xs:string. If $arg is a zero-length string or the empty sequence, the empty sequence is returned.
fn:string-to-codepoints("Thèrése") returns the sequence (84, 104, 233, 114, 232, 115, 101)
fn:substring("123456", 2, 2) => "23"
fn:substring-after("123456", "3") => "456"
fn:substring-before("abcdef", "def") => abc
fn:tokenize("this is a string", " ") => returns the sequence ("this", "is", "a", "string") fn:tokenize("this is a string", " ")[last()] => string
fn:translate("abcd", "abcd", "wxyz") => wxyz
fn:upper-case("Abcd") => ABCD