How to use String function in XML

In this article, we will discuss the string function in XQuery
  • 2066

The String function in XQuery returns the value of arguments, if argument is a empty sequence, the zero-length string is returned and if arguments is a node then it return the string value of node and if string is a atomic value then it returned the same string.  Function on  string value is given below-

  • concat Function
    concat function is used for concatenates two or more string.

Syntax of concat Function

fn:concat ($string as xs:string?,$string as xs:string?[, ...]) as xs:string

  • contains
    The contain function returns true if string one contain a value of string two, otherwise it return false.

Syntax of contain function

fn:contains ($arg1 as xs:string? , $arg2 as xs:string?) as xs:boolean?

  • substring Function
    The sub string function is use to determine the starting location for the substring, where the first character is at position 1.

Syntax of substring

fn:substring($sourceString as xs:string?,

$startingLoc as xs:decimal?,

$length as xs:decimal?) as xs:string?

  • string-length Function
    The length function returns the no of characters in the string. If there is no string argument it returns the length of the string value of the current node

Syntax of string-length

fn:string-length() as xs:integer

fn:string-length($arg as xs:string?) as xs:integer

  • upper-case Function
    The fn:upper-case(string) converts each character into upper case character.

Syntax of upper-case Function

fn:upper-case($arg as xs:string?) as xs:string

  • lower-case Function
    The lower-case Function converts each character into lower case character

Syntax of lower-case Function

fn:lower-case($arg as xs:string?) as xs:string

  • compare
    It is use for comparing between two function.

Syntax of compare Function


  • replace  Function
    The fn:replace function replaces parts of a string that match a regular expression.

Syntax of  replace  Function


Further Readings

You may also want to read these related articles: here
Ask Your Question

Got a programming related question? You may want to post your question here


More Articles

© 2020 DotNetHeaven. All rights reserved.