Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

How does LSL read delimited text?

MadamG Zagato
means business
Join date: 17 Sep 2005
Posts: 1,402
03-05-2006 16:56
How does LSL read a delimted string? How do I break it up and assign each section to its' own string variable?

i.e.
BigString = "The city zoo.;Elephants;Zookeeper;Reptile"

Does it matter what the delimeter is? Can I use a * or a : ???
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
03-05-2006 17:23
There are three functions for reading text into a list, llCSV2List & llParseString2List (and it's friend function llParseStringKeepNulls)

CSV is designed for working with string versions of LSL types.
llParseString2List is what you are looking for, you can parse a string with 8 different seperators and 8 different deliminators all at the same time.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
MadamG Zagato
means business
Join date: 17 Sep 2005
Posts: 1,402
03-05-2006 18:27
Great! Thanks :)

So if I use the WIKI example and use astericks like so:

To split a sentence into words by using "*" as the separator:
llParseString2List("All Cows Eat Grass",["*"],[]);
Returns this list:
["All", "Cows", "Eat", "Grass"]How do I take each value and assign it to its own string?i.e.
string1 =
string2 =
etc...
Marcus Moreau
frand
Join date: 25 Dec 2004
Posts: 602
03-05-2006 18:34
If the length of the list is variable, then you are better off just parsing the list each time you need some of its content (using llList2String). If you know the length of the sentence and list, then you can use a for loop and have a fixed number of variables to assign the contents to. That's my thought anyways.

MM
_____________________
Marcus Moreau

Disenfranchised island owner...

"This statement is false."
User #121869 or something close