# llCSV2List

*LSL function*

```lsl
list list llCSV2List(string src);
```

- `string src`: String of comma-separated values to parse.

- Returns: `list`
- Energy: 10

This function takes a string of values separated by commas, and turns it into a list.

To convert a list into a comma-separated string use [llList2CSV](/functions/llList2CSV/).

Do not confuse this function with the [CSV](https://en.wikipedia.org/wiki/Comma-separated_values) format, it is *not* the CSV format.

Returns a [list](https://wiki.secondlife.com/wiki/list) made by parsing **src**, a string of comma separated values.

```lsl title="How to use" frame="terminal"
list result = llCSV2List("");
```

## Specification

### Vectors & Rotations

Anything between "&lt;" and ">" is considered a single value regardless of the existence of a comma between.

This ensures that [vector](https://wiki.secondlife.com/wiki/vector)s and [rotation](https://wiki.secondlife.com/wiki/rotation)s get treated as a single value, with no additional cleanup needed afterward.

Note, though, that for every "&lt;" there needs to be a corresponding ">" or it will consume the rest of the string. For example,

- `llCSV2List("<>,>,a")` — returns `["<>", ">", "a"]` — (Second ">" is isolated)
- `llCSV2List("<<>,>,a")` — returns `["<<>,>", "a"]` — (Regularly paired)
- `llCSV2List("<<<>,>,a")` — returns `["<<<>,>,a"]` — (Third "&lt;" lost its opposite one)

<table>
</table>

### Types

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.

| Target | Code | Description |
| --- | --- | --- |
| [integer](https://wiki.secondlife.com/wiki/integer) | `(integer)llList2String(mlist, mint)` | [llList2Integer](/functions/llList2Integer/) does not support the hex format |
| [float](https://wiki.secondlife.com/wiki/float) | `(float)llList2String(mlist, mint)` | [llList2Float](/functions/llList2Float/) does not support the scientific or hexadecimal notations |
| [string](https://wiki.secondlife.com/wiki/string) | `llList2String(mlist, mint)` | Always Safe |
| [key](https://wiki.secondlife.com/wiki/key) | `llList2Key(mlist, mint)` | Always Safe |
| [vector](https://wiki.secondlife.com/wiki/vector) | `(vector)llList2String(mlist, mint)` | [llList2Vector](/functions/llList2Vector/) will return a zero vector |
| [rotation](https://wiki.secondlife.com/wiki/rotation) | `(rotation)llList2String(mlist, mint)` | [llList2Rot](/functions/llList2Rot/) will return a zero rotation |

### Whitespace

[llCSV2List](/functions/llCSV2List/) consumes the first leading space from all values :

```lsl
list tmp = llCSV2List("first , second , third");
//returns ["first ","second ","third"]
//not ["first "," second "," third"]
```

## Caveats

- If a "&lt;" does not have a matching ">", the remainder of the string will be a single value, even if the "&lt;" is in the middle of the value, see [Vectors & Rotations](#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).
- When used with lists that are generated based off assets in inventory, [llCSV2List](/functions/llCSV2List/) should not be used, as inventory assets can contain commas as part of their names.

## Examples

<details open>
<summary>Example 1</summary>

```lsl
default
{
    state_entry()
    {
        string csv = "first,second,third";
        list my_list = llCSV2List(csv);
        llOwnerSay("CSV: " + csv);
        integer i;
        integer num_list=llGetListLength(my_list);
        for (i=0; i<num_list; ++i)
        {
            llOwnerSay("my_list[" + (string)i + "]: " + llList2String(my_list,i));
        }
    }
}
```

</details>

## Notes

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](/functions/llParseString2List/) instead, which allows you to specify separators other than commas. [llParseString2List](/functions/llParseString2List/) unfortunately does not support the special parsing required for handling rotations and vectors, nor does it consume leading and trailing whitespace.

## See also

### Functions

- [llList2CSV](/functions/llList2CSV/)
- [llDumpList2String](/functions/llDumpList2String/)
- [llParseString2List](/functions/llParseString2List/)
- [llParseStringKeepNulls](/functions/llParseStringKeepNulls/)

### Articles

- [Typecast](https://wiki.secondlife.com/wiki/Typecast)

---

*Source: [LlCSV2List](https://wiki.secondlife.com/wiki/LlCSV2List) on the Second Life Wiki. Content from the Second Life Wiki article LlCSV2List (revision 1218615, 2026-02-03), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llCSV2List/
