# lil help with string to list?

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

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

## Recommended Posts

Posted (edited)

I just can't wake up today...

I have train tracks that report their number, &  start, mid, and end vectors via regionsay as a string.

after removing the indexing, i'm left with the 3 vectors, that i wish to add to a list.

"<30.404861, 44.845428, 23.429020>, <25.404861, 44.845428, 23.429020>, <20.404861, 44.845428, 23.429020>"

how would one save these strings as vectors?

i can get the first one ...

integer Index = llSubStringIndex(vec, ">,");
string st = llGetSubString(vec, 0 , Index );

Edited by Xiija
##### Share on other sites

```string vectors = "<30.404861, 44.845428, 23.429020>, <25.404861, 44.845428, 23.429020>, <20.404861, 44.845428, 23.429020>";
list data = llCSV2List(vectors);
vector first = llList2Vector(data, 0);
...```

• 1
##### Share on other sites

Posted (edited)
46 minutes ago, Wulfie Reanimator said:
```string vectors = "<30.404861, 44.845428, 23.429020>, <25.404861, 44.845428, 23.429020>, <20.404861, 44.845428, 23.429020>";
list data = llCSV2List(vectors);
vector first = llList2Vector(data, 0);
...```

To make that work, I think you need to read the first item in the list "data" as a string (which is what it is) and then cast it as a vector, thus:

Quote

string vectors = "<30.404861, 44.845428, 23.429020>, <25.404861, 44.845428, 23.429020>, <20.404861, 44.845428, 23.429020>";
list data = llCSV2List(vectors);
vector first = (vector) llList2String(data, 0);

Otherwise it will report "first" as having the value ZERO_VECTOR, because there aren't any vectors in the list data, only strings that look like vectors.

Edited by Innula Zenovka
• 1
##### Share on other sites

Posted (edited)
51 minutes ago, Wulfie Reanimator said:
`vector first = llList2Vector(data, 0);`

TY ,  i hadda change a lil bit, but works,

vector first = (vector)llList2String(data, 0);

( Innula beat me! )

Edited by Xiija
##### Share on other sites

12 minutes ago, Innula Zenovka said:

To make that work, I think you need to read the first item in the list "data" as a string (which is what it is) and then cast it as a vector, thus:

I had forgotten that llCSV2List() was event smart enough even to separate on the "<..>", so it's not too terrible if you have to cast it back to a Vector.

• 1
##### Share on other sites

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

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