stringlist
Parses lists of strings into array.
Usage
This module takes strings in a list form and parses them to an array of strings
var stringlist = ;stringlist;// [ 'item', 'another item', 'yet another item' ]
API
Parsing
stringlist
returns an array of strings parsed from the input. you can define your own options.delimiter
if you don't want to use ,
as a delimiter.
Format
The stringlist accepts two types of items
-
unquoted items are trimmed and returned as they were in the input string.
-
quoted items (either with
'
or"
) are treated as if they were javascript strings. They are not trimmed and all special characters must be escaped. Escaped characters are returned as they were
example
// unquoted strings are trimmedstringlist;// [ 'item 1', 'item 2', 'item 3' ] // quoted strings are not trimmedstringlist;// [ ' item 1', ' item 2 ', 'item 3 ' ] // unquoted strings are not unescapedstringlist;// [ '\"' ] // quoted strings are unescapedstringlist;// [ ' " ' ]