String functions

The following string functions are supported:

  • compare: Compares the ASCII codes of two strings. Returns -1 if $comparand1 is less than $comparand2, 0 if $comparand1 is equal to $comparand2, or 1 if $comparand1 is greater than $comparand2 (according to the rules of the collation that are used).
  • Full description: http://www.w3.org/TR/xpath-functions/#func-compare
    • contains: Returns true if $arg1 contains the characters of $arg2 anywhere in its contents, including at the beginning or end.
  • Full description: http://www.w3.org/TR/xpath-functions/#func-contains
    • concat: Concatenates the given strings and returns a string.
    • Full description: http://www.w3.org/TR/xpath-functions/#func-concat
    • ends-with: Returns an xs:boolean value indicating whether one string ($arg1) ends with the characters of a second string ($arg2).
  • Full description: http://www.w3.org/TR/xpath-functions/#func-ends-with
    • lower-case: Returns the value of the given string after it translates every character to its lower-case equivalent as defined in the appropriate case mappings section in the Unicode standard.
    • Full description: http://www.w3.org/TR/xpath-functions/#func-lower-case
    • matches: Returns true if the $input matches the $pattern; otherwise, returns false.
  • Full description: http://www.w3.org/TR/xpath-functions/#func-matches
    • normalize-space: Returns the value of the given string with a white space normalized by stripping leading and trailing whitespace, and replacing sequences of one or more than one whitespace character with a single space, #x20.
    • Full description: http://www.w3.org/TR/xpath-functions/#func-normalize-space
    • replace: Replaces parts of a string that matches it with a regular expression.
    • Full description: http://www.w3.org/TR/xpath-functions/#func-replace
    • starts-with: Returns an xs:boolean value indicating whether one string ($arg1) starts with the characters of a second string ($arg2).
  • Full description: http://www.w3.org/TR/xpath-functions/#func-starts-with
    • string-length: Returns an xs:integer value indicating the number of characters in the string. Whitespace is significant; leading and trailing whitespace characters are counted.
  • Full description:
  • http://www.w3.org/TR/xpath-functions/#func-string-length
    • substring: Returns the portion of the value of $sourceString beginning at the position indicated by the value of $startingLoc and continuing for the number of characters indicated by the value of $length. The characters returned do not extend beyond $sourceString. If $startingLoc is zero or negative, only those characters in positions greater than zero are returned.
    • Full description: http://www.w3.org/TR/xpath-functions/#func-substring
    • substring-after: Extracts all characters of a string ($arg1) that appear after the first occurence of another specified string ($arg2).
  • Full description: http://www.w3.org/TR/xpath-functions/#func-substring-after
    • substring-before: Extracts extracts all the characters of a string ($arg1) that appear before the first occurence of another specified string ($arg2).
  • Full description: http://www.w3.org/TR/xpath-functions/#func-substring-before
    • translate: Replaces individual characters of a string with other individual characters. The $mapString argument is a list of characters to be changed, and $transString is the list of replacement characters. Each character in $mapString is replaced by the character in the same position in $transString. If $mapString is longer than $transString, the characters in $mapString that have no corresponding character in $transString are not included in the result. Characters in the original string that do not appear in $mapString are copied to the result unchanged.
  • Full description: http://www.w3.org/TR/xpath-functions/#func-translate
    • upper-case: Returns the value of the given string after it translates every character to its upper-case equivalent as defined in the appropriate case mappings section in the Unicode standard.
    • Full description: http://www.w3.org/TR/xpath-functions/#func-upper-case

    Related Links