Counts the length of $string-var.
If the value of $string-var is the empty sequence, the empty sequence is returned. The empty sequence is a sequence containing zero items (), which is similar to null in SQL.
xf:string-length(xs:string? $string-var) —> xs:integer?
Returns an integer equal to the length of the $string-var.
Invoking string-length("moo cow") returns the integer 7, as shown in the following example query:
<result>{xf:string-length("moo cow")}</result>
The preceding query generates the following result:
<result>7</result>
Invoking string-length(()) returns the null string as shown in the following example query:
<result>{xf:string-length(())}</result>
Note: The string: () is the empty sequence (similar to a SQL null) which is a sequence containing zero items.
The preceding query generates the following result:
<result/>
W3C string-length function description.