Javatpoint Logo
Javatpoint Logo

XQuery string-length() Function

The XQuery string-length function is used to get the length of a string.

Parameter explanation:

$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.

XQuery Expression:


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 using console. You must have JDK 1.5 or later installed on your computer and classpaths are configured.




java XQueryTester


XQUERY String length function 1

The above example specifies that the given string-length is 16. Space is treated as length character.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA