Product Site

5.1.7.74. makeArray

This method returns an Array of the receiving string's strings substrings that were separated by the separator string. separator may be any string, including the null string. If the null string is used, an Array containing each character of the string is returned. If the target string starts with the separator, the first Array item will be a null string. If the string ends with a separator, no extra null string item will be added. If separator isn't specified, any line-end indicator is honored.
Example 5.111. String class — makeArray method
string = "hello".endofline"world".endofline"this is an array."
array = string~makeArray
Say "the second line is:" array[2]  /*  world              */

string = "hello*world*this is an array."
array = string~makeArray("*")
Say "the third line is:" array[3]   /*  this is an array.  */

string = "hello*world*this is an array.*"
array = string~makeArray("*")       /*  contains 3 items   */