Returns 1-true if the string or the text passed in the first arguments ended by the string or text passed in the second argument, and otherwise 0-false.

1 string.endsWith

<string.endsWith>
    <text /> !
    <ends /> !
</string.endsWith>

Exceptions

requires 2 arguments, received: ...

The two entry parameters has not been specified.

Remarks

If the value of the second argument is null, the function returns as result 1, it means it is true.

Example

The text indicated in the argument 1 ends by the string or text indicated in the argument 2.

Copy
<xsql-script name='string_endsWith1'>
    <body>
        <set name='a'>Hello world</set>
        <set name='b'>world</set>
        <if>
            <expr><string.endsWith><a /><b /></string.endsWith></expr>
            <then>
                <println>'<a />'<string> ends with </string>'<b />'</println>
            </then>
            <else>
                <println>'<a />'<string> does not end with </string>'<b />'</println>
            </else>
        </if>
    </body>
</xsql-script>

Returns:

Copy
'Hello world' ends with 'world'
Example

The text indicated in the argument 1 does not end with the string or text indicated in the argument 2.

Copy
<xsql-script name='string_endsWith2'>
   <body>
       <set name='a'>Hello world</set>
       <set name='b'>world</set>
       <if>
           <expr><string.endsWith><a /><b /></string.endsWith></expr>
           <then>
               <println>'<a />'<string> ends with </string>'<b />'</println>
           </then>
           <else>
               <println>'<a />'<string> does not end with </string>'<b />'</println>
           </else>
       </if>
   </body>
</xsql-script>

Returns:

Copy
'Hello world' does not end with 'world'