Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGetSubString - Got it to work one way, but not another way.

Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
07-12-2004 00:31
I have a 4 character string, for this example, "CA13"

I have successfully used llGetSubString to get the "13" off the end and thanks to Ace Cassidy, learned how to convert it into an integer.

I can't figure out the llGetSubString statement to use to extract the "C" and the "A" into two separate variables.

Any help would, as always, be greatly appreciated!
Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
07-12-2004 00:56
I've been able to get the "C"... but after 20 minutes of trying to get the "A" I still need help.
Moopf Murray
Moopfmerising
Join date: 7 Jan 2004
Posts: 2,448
07-12-2004 01:30
llGetSubString("CA13",0,1) should return the first 2 characters. This means start at position 0 and end at position 1.
Aaron Levy
Medicated Lately?
Join date: 3 Jun 2004
Posts: 2,147
07-12-2004 01:42
How do I get just the 2nd character, the "A"?
Moopf Murray
Moopfmerising
Join date: 7 Jan 2004
Posts: 2,448
07-12-2004 01:47
OK, positions in strings start at 0, so in your example:

CODE

CA13 - your string
0123 - positions


So, to get the 'A' character, you would use:

llGetSubString("CA13",1,1);

This just gets a single character at position 1.