XQuery string-length() Function
The XQuery string-length function is used to get the length of a string.
$string: It specifies the provided string.
XQuery string-length Example
Let's take an example to demonstrate the usage of XQuery string-length function. Take an XQuery expression named "books.xqy", having the following code.
Create a Java based XQuery executor program to read the books.xqy, passes it to the XQuery expression processor, and executes the expression. After that the result will be displayed.
Execute XQuery against XML
Put the above both files to a same location. We put them on desktop in a folder name XQuery13. Compile XQueryTester.java using console. You must have JDK 1.5 or later installed on your computer and classpaths are configured.
The above example specifies that the given string-length is 16. Space is treated as length character.