Difference between revisions of "Category:LSL CSV"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{LSL Header}}
{{LSL Header|ml=*}}{{LSLC|}}{{LSLC|Data Conversion}}


The most important thing to know about LSL CSV, it's not traditional CSV. It is not RFC 4180.
The most important thing to know about LSL CSV, it's not traditional CSV. It is not RFC 4180.
<div id="box">
== Caveats ==
<div style="padding: 0.5em;">


There are four caveats with LSL CSV.
There are four caveats with LSL CSV.
Line 9: Line 15:
#*Having a ">" before a "<" has no effect on the output, having too many ">" is not an issue.
#*Having a ">" before a "<" has no effect on the output, having too many ">" is not an issue.
#All Commas not encapsulated in "<" ">" will be treated as deliminators.
#All Commas not encapsulated in "<" ">" will be treated as deliminators.
#Anything datatype containing a float value when converted to a CSV may loose precision.  
#Any datatype containing a float value when converted to a CSV may loose precision.


<pre>
<lsl>llCSV2List("<>,>,a")  == ["<>", ">", "a"]; //didn't match the last ">"
llCSV2List("<>,>,a")  == ["<>", ">", "a"]; //didn't match the last ">"
llCSV2List("<<>,>,a")  == ["<<>,>", "a"];  //matched everything
llCSV2List("<<>,>,a")  == ["<<>,>", "a"];  //matched everything
llCSV2List("<<<>,>,a") == ["<<<>,>,a"];    //didn't match the last "<"
llCSV2List("<<<>,>,a") == ["<<<>,>,a"];    //didn't match the last "<"</lsl>
</pre>
</div></div>
<div id="box">
 
== Examples ==
<div style="padding: 0.5em;">


===One Way To Embed CSV Lists in CSV Lists===
'''One Way To Embed CSV Lists in CSV Lists'''
<pre>
<lsl>string a = llList2CSV([
string a = llList2CSV([
         "<"+llList2CSV(["a", "b", "c"])+">",
         "<"+llList2CSV(["a", "b", "c"])+">",
         "<"+llList2CSV(["d", "e", "f"])+">",
         "<"+llList2CSV(["d", "e", "f"])+">",
         "<"+llList2CSV(["g", "h", "i"])+">"
         "<"+llList2CSV(["g", "h", "i"])+">"
     ]);
     ]);</lsl>
</pre>
</div></div>

Latest revision as of 15:04, 24 October 2008

The most important thing to know about LSL CSV, it's not traditional CSV. It is not RFC 4180.


Caveats

There are four caveats with LSL CSV.

  1. Spaces are trimmed from the beginning and the end of entries.
  2. Anything following a "<" is considered part of the same item as long as the number of ">" and "<" are unbalanced.
    • All "<" and ">" are included in the output string.
    • Having a ">" before a "<" has no effect on the output, having too many ">" is not an issue.
  3. All Commas not encapsulated in "<" ">" will be treated as deliminators.
  4. Any datatype containing a float value when converted to a CSV may loose precision.

<lsl>llCSV2List("<>,>,a") == ["<>", ">", "a"]; //didn't match the last ">" llCSV2List("<<>,>,a") == ["<<>,>", "a"]; //matched everything llCSV2List("<<<>,>,a") == ["<<<>,>,a"]; //didn't match the last "<"</lsl>

Examples

One Way To Embed CSV Lists in CSV Lists <lsl>string a = llList2CSV([

       "<"+llList2CSV(["a", "b", "c"])+">",
       "<"+llList2CSV(["d", "e", "f"])+">",
       "<"+llList2CSV(["g", "h", "i"])+">"
   ]);</lsl>

Pages in category "LSL CSV"

The following 2 pages are in this category, out of 2 total.