Parses the list of strings encoded into a single string (the list specification) passed in the first parameter and returns the array of all found strings.
This function is similar to breakString()
function, however, it provides a way to specify and parse string lists
even when the list separator itself may be a part of those strings.
That is done by using quotes. Anything within quotes is treated as a part of one of the strings.
For example, the expression:
str_list = 'A, B, {"C,D"}';
parseStringList (str_list, ",")
[ "A", "B", "{C,D}" ]
'
) or double ("
). When the quotation character itself
needs to be inserted within the quoted sequence, it must be escaped with slash (\
).
The same concerns also the slash character. For example, the sequence:
A'B\'C\\'D
AB'C\D
spec
separator
trimSpaces
Besides that, when true
, the empty strings and those consisting of only whitespaces will
be ignored and not included in the result array.
This, however, does not apply to whitespaces found within quotes. All of them will be preserved in any case. Also, even the empty quotes will produce a string inserted in the result array. For example, the expression:
str_list = "1 , 2, ,3, '', ' 4 '";
parseStringList (str_list, ",", true)
[ "1", "2", "3", "", " 4 " ]
true
.
breakString()