This function returns a java.util.ArrayList with the elements of text divided, based in the set of dividers (tokens) which are passed as attributes. Also you can indicate that it returns also the dividers (tokens) with the attribute delims as value true.

It returns an array with the elements of a string. The elements are obtained according to the dvision of the string through the indicated characters.

1 string.getTokens

<string.getTokens
    tokens='tokens'
    delims='delims'
>
    <text /> !
</string.getTokens>
Example
Copy
<xsql-script name='string._getTokens_sample1'>
    <body>
        <set name='text'>SELECT * FROM TABLE WHERE rowid = @rowid</set>
        <set name='tokens'> @''</set>
        <set name='arr'><string.getTokens tokens='#tokens' delims='true'><text /></string.getTokens></set>
        <set name='arrsize'><sub><array.size name='arr' />1</sub></set>
        <for name='idx' start='0' end='#arrsize'>
    	    <do>
    	        <println><idx /> :  <array.get name='arr'><idx /></array.get> </println>
    	    </do>
        </for>
    </body>
</xsql-script>

Returns:

Copy
0 :  SELECT 
1 :    
2 :  * 
3 :    
4 :  FROM 
5 :    
6 :  TABLE 
7 :    
8 :  WHERE 
9 :    
10 :  rowid 
11 :    
12 :  = 
13 :    
14 :  @ 
15 :  rowid