Jump to content

Change a string to a list


Loki Eliot
 Share

You are about to reply to a thread that has been inactive for 2695 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Actually, I'm not sure whether you wanted to keep the quote marks in your final list or not.  Either way, you can do the cleaning and conversion with something like this:

default{    state_entry()    {        llListen(-12345,"","","");    }    listen(integer channel, string name, key id, string message)    {        llSay(0, "I heard " + message);        integer len = llStringLength(message);        while (len)        {            --len;            if (~llListFindList(["[",]","\""],[llGetSubString(message,len,len)]))            {                message = llDeleteSubString(message,len,len);            }        }        llSay(0,"Here's the string with square brackets and quotes removed: " + message);        list New = llCSV2List(message);  // Here's your list        llSay(0,"And here's a dump of a list created from that string, with each list element on a separate line so you can see them: \n" + llDumpList2String(New,"\n"));    }}

If you really meant to keep the quotes in your final list, just remove the "\"" from that llListFindList line.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2695 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...