From Second Life Wiki
|LSL Portal||Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials|
This function takes a string of values separated by commas, and turns it into a list.
Returns a list made by parsing src, a string of comma separated values.
Vectors & Rotations
Anything between "<" and ">" is considered a single value regardless of the existence of a comma between.
Note, though, that for every "<" there needs to be a corresponding ">" or it will consume the rest of the string. For example,
|•|| ||–|| returns ||(Second ">" is isolated)|
|•|| ||–|| returns ||(Regularly paired)|
|•|| ||–|| returns ||(Third "<" lost its opposite one)|
The function makes no assumptions about what the list entry types should be, all elements in the resulting list will be strings. It is important to know that the llList2* functions implicit typecasts do not work the same as explicit typecast. The following table gives code examples for each type that will yield the best results.
|integer||llList2Integer does not support the hex format|
|float||llList2Float does not support the scientific or hexadecimal notations|
|vector||llList2Vector will return a zero vector|
|rotation||llList2Rot will return a zero rotation|
llCSV2List consumes the first leading space from all values :
list tmp = llCSV2List("first , second , third"); //returns ["first ","second ","third"] //not ["first "," second "," third"]
- If a "<" does not have a matching ">", the remainder of the string will be a single value, even if the "<" is in the middle of the value, see Vectors & Rotations for further details.
- All items in the returned list are strings.
- If an empty string is parsed, the result will a list containing an empty string: [""] (not an empty list).
To use separators other than commas (especially if you can't predict when a user might have sneaked a comma into data they supply the script), use llParseString2List instead, which allows you to specify separators other than commas. llParseString2List unfortunately does not support the special parsing required for handling rotations and vectors, nor does it consume leading and trailing whitespace.
function list llCSV2List( string src );