stringToList

From RPTools Wiki
Revision as of 10:02, 14 December 2008 by Craig (talk | contribs) (New page: ==Function stringToList== Converts a string into a Macros:string list using a pattern to determine separator between elements. The specified delimiter is used to separate the element...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function stringToList

Converts a string into a string list using a pattern to determine separator between elements. The specified delimiter is used to separate the elements in the Macros:string list if it is specified, otherwise the default value of "," is used. Pattern can be a regular expression.

Usage

[h: list = stringToList(str,  pattern)]
[h: list = stringToList(str, pattern, delim)]


Example

    [stringToList("This is a test", " ")]
    [stringToList("1,2,3,4", ",", ":")]

Returns

   This,is,a,test
   1:2:3:4