Difference between revisions of "LlCSV2List"

From Second Life Wiki
Jump to navigation Jump to search
Line 2: Line 2:
|func_id=196|func_sleep=0.0|func_energy=10.0
|func_id=196|func_sleep=0.0|func_energy=10.0
|func=llCSV2List|return_type=list|p1_type=string|p1_name=src
|func=llCSV2List|return_type=list|p1_type=string|p1_name=src
|func_footnote
|func_footnote=
Do not confuse this function with the {{Wikipedia|CSV|CSV}} format, it is ''not'' the CSV format.
|func_desc
|func_desc
|return_text=made from '''src''' as comma separated values.
|return_text=made from '''src''' as comma separated values.
|spec=Anything between "<" and ">" is considered a single value regardless of the existence of a comma between.
|spec=Anything between "<" and ">" is considered a single value regardless of the existence of a comma between. For every "<" there needs to be a corresponding ">".
<pre>
llCSV2List("<>,>,a")  == ["<>", ">", "a"];
llCSV2List("<<>,>,a")  == ["<<>,>", "a"];
llCSV2List("<<<>,>,a") == ["<<<>,>,a"];
</pre>
 
|caveats=*It eats leading and trailing spaces from values.
|caveats=*It eats leading and trailing spaces from values.
* It will turn strings that look like vectors or rotations into vectors or rotations
* Anything between "<" and ">" is considered a single value, see [[#Specification|Specification]] for further details.
** ''<1, 2, 3>'' will be turned into a list with 1 element, not 3
** This is done so that the function can handle [[vector]]s and [[rotation]]s without extra parsing.
|constants
|constants
|examples=<pre>
|examples=<pre>

Revision as of 00:27, 12 April 2007

Summary

Function: list llCSV2List( string src );

Returns a list made from src as comma separated values.

• string src

Do not confuse this function with the "Wikipedia logo"CSV format, it is not the CSV format.

Specification

Anything between "<" and ">" is considered a single value regardless of the existence of a comma between. For every "<" there needs to be a corresponding ">".

llCSV2List("<>,>,a")   == ["<>", ">", "a"];
llCSV2List("<<>,>,a")  == ["<<>,>", "a"];
llCSV2List("<<<>,>,a") == ["<<<>,>,a"];

Caveats

  • It eats leading and trailing spaces from values.
  • Anything between "<" and ">" is considered a single value, see Specification for further details.
    • This is done so that the function can handle vectors and rotations without extra parsing.
All Issues ~ Search JIRA for related Bugs

Examples

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

See Also

Functions

•  llList2CSV
•  llDumpList2String
•  llParseString2List
•  llParseStringKeepNulls

Articles

•  Typecast

Deep Notes

Search JIRA for related Issues

Signature

function list llCSV2List( string src );