Returns the length of this string. The length is equal to the number of unites of Unicode in the string.

1 string.length

<string.length>
    <value /> !
</string.length>

Exceptions

requires 1 arguments, received: ...

The entry parameter has not been specified.

Remarks

This function is very useful because has several utilities, for example, it allows to know the size of a string to perform a substring in a secure way.

Example

Show the length of a string of characters.

Copy
<xsql-script name='string_length'>
    <body>
        <set name='a'>This is a string of characters.</set>
        <println><string.length><a /></string.length></println>
    </body>
</xsql-script>

Returns:

Copy
33
Example

Shows the length of a string of characters.

Copy
<xsql-script name='string_length'>
   <body>
       <set name='a'>This is a string of characters.</set>
       <println><string.length><a /></string.length></println>

       <if>
           <expr><lt>19<string.length><a /></string.length></lt></expr>
           <then>
               <println>
                   <string.substring>
                       <a /><number>19</number><string.length><a /></string.length>
                   </string.substring>
               </println>
           </then>
       </if>
   </body>
</xsql-script>

If the length os the string of characters is greater to 19, this string is shown from the position 29 until the end.

Copy
33

                   of characters.