<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.osgrid.org/index.php?action=history&amp;feed=atom&amp;title=LlCSV2List</id>
	<title>LlCSV2List - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.osgrid.org/index.php?action=history&amp;feed=atom&amp;title=LlCSV2List"/>
	<link rel="alternate" type="text/html" href="http://wiki.osgrid.org/index.php?title=LlCSV2List&amp;action=history"/>
	<updated>2026-10-25T11:50:19Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>http://wiki.osgrid.org/index.php?title=LlCSV2List&amp;diff=81&amp;oldid=prev</id>
		<title>Osgridadmin: /* Function: list llCSV2List( string src ); */</title>
		<link rel="alternate" type="text/html" href="http://wiki.osgrid.org/index.php?title=LlCSV2List&amp;diff=81&amp;oldid=prev"/>
		<updated>2017-12-30T16:30:55Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Function: list llCSV2List( string src );&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Function: list llCSV2List( string src );==&lt;br /&gt;
This function takes a string of values separated by commas, and turns it into a list. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
Returns a list made by parsing src, a string of comma separated values.&amp;lt;br&amp;gt;&lt;br /&gt;
• string 	src &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;			&lt;br /&gt;
To convert a list into a comma-separated string use [[llList2CSV]].&amp;lt;br&amp;gt;&lt;br /&gt;
Do not confuse this function with the CSV format, it is not the CSV format.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Specification&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
Vectors &amp;amp; Rotations &amp;lt;br&amp;gt;&lt;br /&gt;
Anything between &amp;quot;&amp;lt;&amp;quot; and &amp;quot;&amp;gt;&amp;quot; is considered a single value regardless of the existence of a comma between. &amp;lt;br&amp;gt;&lt;br /&gt;
This ensures that vectors and rotations get treated as a single value, with no additional cleanup needed afterward. &amp;lt;br&amp;gt;&lt;br /&gt;
Note, though, that for every &amp;quot;&amp;lt;&amp;quot; there needs to be a corresponding &amp;quot;&amp;gt;&amp;quot; or it will consume the rest of the string :  &amp;lt;br&amp;gt;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
llCSV2List(&amp;quot;&amp;lt;&amp;gt;,&amp;gt;,a&amp;quot;)   == [&amp;quot;&amp;lt;&amp;gt;&amp;quot;, &amp;quot;&amp;gt;&amp;quot;, &amp;quot;a&amp;quot;]; //didn&amp;#039;t match the last &amp;quot;&amp;gt;&amp;quot;&lt;br /&gt;
llCSV2List(&amp;quot;&amp;lt;&amp;lt;&amp;gt;,&amp;gt;,a&amp;quot;)  == [&amp;quot;&amp;lt;&amp;lt;&amp;gt;,&amp;gt;&amp;quot;, &amp;quot;a&amp;quot;];   //matched everything&lt;br /&gt;
llCSV2List(&amp;quot;&amp;lt;&amp;lt;&amp;lt;&amp;gt;,&amp;gt;,a&amp;quot;) == [&amp;quot;&amp;lt;&amp;lt;&amp;lt;&amp;gt;,&amp;gt;,a&amp;quot;];     //didn&amp;#039;t match the last &amp;quot;&amp;lt;&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Types&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
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. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; border=&amp;quot;.5&amp;quot; style=&amp;quot;text-align:left&amp;quot;&lt;br /&gt;
! bgcolor=&amp;quot;black&amp;quot; | &amp;lt;span style=&amp;quot;color:#CC6633&amp;quot;&amp;gt;Target  !! bgcolor=&amp;quot;black&amp;quot; | &amp;lt;span style=&amp;quot;color:#CC6633&amp;quot;&amp;gt;Code !! bgcolor=&amp;quot;black&amp;quot; | &amp;lt;span style=&amp;quot;color:#CC6633&amp;quot;&amp;gt;Description &lt;br /&gt;
|-&lt;br /&gt;
| [[integer]] || ([[integer]])[[llList2String]](mlist, mint) || [[llList2Integer]] does not support the hex format &lt;br /&gt;
|-&lt;br /&gt;
| [[float]] || ([[float]])[[llList2String]](mlist, mint) || [[llList2Float]] does not support the scientific or hexadecimal notations&lt;br /&gt;
|-&lt;br /&gt;
| [[string]] || [[llList2String]](mlist, mint) || Always Safe&lt;br /&gt;
|-&lt;br /&gt;
| [[key]] || [[llList2Key]](mlist, mint) || 	Always Safe &lt;br /&gt;
|-&lt;br /&gt;
| [[rotation]] || ([[rotation]])[[llList2String]](mlist, mint) || [[llList2Rot]] will return a zero rotation&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Whitespace&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
llCSV2List consumes leading and trailing spaces from all values : &amp;lt;br&amp;gt;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
list tmp = llCSV2List(&amp;quot;first , second , third&amp;quot;);&lt;br /&gt;
//returns [&amp;quot;first&amp;quot;,&amp;quot;second&amp;quot;,&amp;quot;third&amp;quot;]&lt;br /&gt;
//not [&amp;quot;first &amp;quot;,&amp;quot; second &amp;quot;,&amp;quot; third&amp;quot;]&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Caveats&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
• If a &amp;quot;&amp;lt;&amp;quot; does not have a matching &amp;quot;&amp;gt;&amp;quot;, the remainder of the string will be a single value, even if the &amp;quot;&amp;lt;&amp;quot; is in the middle of the value, see Vectors &amp;amp; Rotations for further details. &amp;lt;br&amp;gt;&lt;br /&gt;
• All items in the returned list are strings. &amp;lt;br&amp;gt;&lt;br /&gt;
• Leading and trailing spaces are removed from all values. &amp;lt;br&amp;gt;&lt;br /&gt;
• If an empty string is parsed, the result will a list containing an empty string: [&amp;quot;&amp;quot;] (not an empty list).  &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Examples&amp;#039;&amp;#039;&amp;#039;&amp;lt;br&amp;gt;&lt;br /&gt;
{|border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;5&amp;quot; cellspacing=&amp;quot;0&amp;quot;&lt;br /&gt;
|&amp;lt;source lang=&amp;quot;lsl&amp;quot;&amp;gt;&lt;br /&gt;
default&lt;br /&gt;
{&lt;br /&gt;
    state_entry()&lt;br /&gt;
    {&lt;br /&gt;
        string csv = &amp;quot;first,second,third&amp;quot;;&lt;br /&gt;
        list my_list = llCSV2List(csv);&lt;br /&gt;
        llOwnerSay(&amp;quot;CSV: &amp;quot; + csv);&lt;br /&gt;
        integer i;&lt;br /&gt;
        for (i=0; i&amp;lt;llGetListLength(my_list); ++i)&lt;br /&gt;
        {&lt;br /&gt;
            llOwnerSay(&amp;quot;my_list[&amp;quot; + (string)i + &amp;quot;]: &amp;quot; + llList2String(my_list,i));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Notes&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
To use separators other than commas (especially if you can&amp;#039;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. &amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
See Also &amp;lt;br&amp;gt;&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Functions&amp;#039;&amp;#039;&amp;#039; &amp;lt;br&amp;gt;&lt;br /&gt;
•  	[[llList2CSV]] 		 &amp;lt;br&amp;gt;	&lt;br /&gt;
•  	[[llDumpList2String]] 	 &amp;lt;br&amp;gt;		&lt;br /&gt;
•  	[[llParseString2List]] 	 &amp;lt;br&amp;gt;		&lt;br /&gt;
•  	[[llParseStringKeepNulls]] 	 &amp;lt;br&amp;gt;&lt;/div&gt;</summary>
		<author><name>Osgridadmin</name></author>
	</entry>
</feed>