Converts a text in an array (java.util.ArrayList) of lines using \n as separator. It is equivalent to string.split with pattern newline.
1 string.toArray
<string.toArray>
<text /> !
</string.toArray>
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Etext | string |
Returns | |
---|---|
Type | Description |
ArrayList |
Exceptions
requires 1 arguments, received: ...
The entry parameter has not been specified.
input/output exception ...
input/output excepción.
Example
Returns the ArrayList of Strings.
Copy
<xsql-script name='string._toArray_sample1'> <body> <set name='text'>This is a test. New line. Another line below.</set> <set name='arr'><string.toArray><text /></string.toArray></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 : This is a test. 1 : New line. 2 : Another line below.