Difference between revisions of "LlCSV2List"

From Second Life Wiki
Jump to navigation Jump to search
m (updated lsl tags)
Line 17: Line 17:
** This is done so that the function can handle [[vector]]s and [[rotation]]s without extra parsing.
** This is done so that the function can handle [[vector]]s and [[rotation]]s without extra parsing.
* All items in the returned list are strings until [[typecast]].
* All items in the returned list are strings until [[typecast]].
* llCSV2List("") returns [""], not []
|constants
|constants
|examples=
|examples=

Revision as of 10:46, 2 May 2008

Summary

Function: list llCSV2List( string src );
0.0 Forced Delay
10.0 Energy

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 ">". <lsl> llCSV2List("<>,>,a") == ["<>", ">", "a"]; //didn't match the last ">" llCSV2List("<<>,>,a") == ["<<>,>", "a"]; //matched everything llCSV2List("<<<>,>,a") == ["<<<>,>,a"]; //didn't match the last "<" </lsl>

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 items in the returned list are strings until typecast.
  • llCSV2List("") returns [""], not []

Examples

<lsl> 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));
       }
   }
}</lsl>

See Also

Functions

•  llList2CSV
•  llDumpList2String
•  llParseString2List
•  llParseStringKeepNulls

Articles

•  Typecast

Deep Notes

Signature

function list llCSV2List( string src );