Difference between revisions of "LlList2CSV"

From Second Life Wiki
Jump to navigation Jump to search
(Alternative to llEscapeURL)
m
Line 9: Line 9:
|return_text=of comma separated values taken in order from '''src'''.
|return_text=of comma separated values taken in order from '''src'''.
|spec
|spec
|caveats=*[[llCSV2List]] will not reverse the process if there are commas in any of the original strings. One way around this is to first use [[llEscapeURL]] on any user-supplied strings before adding them to the list. [[llUnescapeURL]] will reverse [[llEscapeURL]] or a cheaper way would be to use < and > as double quotes around the string and [[llGetSubString]] with START at 1 and END at -2.
|caveats=*[[llCSV2List]] will not reverse the process if there are commas or oddly matched angle brackets ('''<''' and '''>''') in any of the original strings. For details see the article [[llCVS2List]].
** One way around this is to first use [[llEscapeURL]] on any user-supplied strings before adding them to the list. [[llUnescapeURL]] will reverse [[llEscapeURL]].
** If your strings may contain commas but not unmatched angle brackets you can wrap your strings with angle brackets (< and >) like you would use double quotes around the string and then use [[llGetSubString]] with START at 1 and END at -2 to remove them.
|constants
|constants
|examples=<lsl>default
|examples=<lsl>default

Revision as of 12:25, 28 October 2012

Summary

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

Returns a string of comma separated values taken in order from src.

• list src

More precisely the values are separated with a comma and a space (", ").

This function's functionality is equivalent to llDumpList2String(src, ", ");

The result of this function is more or less the "Wikipedia logo"CSV format, but it does not conform in all its details.

To reverse the process use llCSV2List. But see the Caveat.

Caveats

  • llCSV2List will not reverse the process if there are commas or oddly matched angle brackets (< and >) in any of the original strings. For details see the article llCVS2List.
    • One way around this is to first use llEscapeURL on any user-supplied strings before adding them to the list. llUnescapeURL will reverse llEscapeURL.
    • If your strings may contain commas but not unmatched angle brackets you can wrap your strings with angle brackets (< and >) like you would use double quotes around the string and then use llGetSubString with START at 1 and END at -2 to remove them.

Examples

<lsl>default {

   state_entry()
   {
       list my_list = [1, 2.0, "a string", llGetPos(), llGetRot(), llGetOwner()];
       llOwnerSay(llList2CSV(my_list));        
   }
}</lsl>

See Also

Functions

•  llCSV2List
•  llDumpList2String
•  llParseString2List
•  llParseStringKeepNulls

Articles

•  Typecast

Deep Notes

Signature

function string llList2CSV( list src );