Difference between revisions of "LlList2CSV"

From Second Life Wiki
Jump to: navigation, search
(added caveat)
m (<lsl> tag to <source>)
 
(7 intermediate revisions by 5 users not shown)
Line 4: Line 4:
 
|func_footnote=More precisely the values are separated with a comma and a space (", ").<br/><br/>
 
|func_footnote=More precisely the values are separated with a comma and a space (", ").<br/><br/>
 
This function's functionality is equivalent to <code style="white-space: nowrap;">[[llDumpList2String]]('''src''', ", ");</code><br/><br/>
 
This function's functionality is equivalent to <code style="white-space: nowrap;">[[llDumpList2String]]('''src''', ", ");</code><br/><br/>
Do not confuse this function with the {{Wikipedia|CSV|CSV}} format, it is ''not'' the CSV format.
+
The result of this function is more or less the {{Wikipedia|Comma-separated_values|CSV}} format, but it does not conform in all its details.<br/><br/>
To reverse the process use [[llCSV2List]].
+
To reverse the process use [[llCSV2List]].  But see the Caveat.
 
|func_desc
 
|func_desc
 
|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=Remember to capture the result of the operation with a variable, unless you are planning to act directly on the results.
+
|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 [[llCSV2List]].
 +
** 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=
 +
<source lang="lsl2">
 +
default
 
{
 
{
 
     state_entry()
 
     state_entry()
 
     {
 
     {
         list my_list = [1, 2.0, "a string", llGetPos(), llGetRot(), llGetOwner()];
+
         list my_list = [FALSE, PI, "a string", ZERO_VECTOR, ZERO_ROTATION, NULL_KEY];
 
         llOwnerSay(llList2CSV(my_list));         
 
         llOwnerSay(llList2CSV(my_list));         
 
     }
 
     }
}</lsl>
+
}
 +
</source>
 
|helpers
 
|helpers
 
|also_functions={{LSL DefineRow||[[llCSV2List]]}}
 
|also_functions={{LSL DefineRow||[[llCSV2List]]}}

Latest revision as of 10:41, 22 January 2015

Summary

Function: string llList2CSV( list src );

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 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 llCSV2List.
    • 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.
All Issues ~ Search JIRA for related Bugs

Examples

default
{
    state_entry()
    {
        list my_list = [FALSE, PI, "a string", ZERO_VECTOR, ZERO_ROTATION, NULL_KEY];
        llOwnerSay(llList2CSV(my_list));        
    }
}

See Also

Functions

•  llCSV2List
•  llDumpList2String
•  llParseString2List
•  llParseStringKeepNulls

Articles

•  Typecast

Deep Notes

Search JIRA for related Issues

Signature

function string llList2CSV( list src );