Stripping strings

hi.

i have 10 sentences i am importing into flash from xml. here is a sample:


my frog has four legs!

i parse it and place it in a variable c.

what i really want is the punctuation put into its own array. i strip c like this:


var strings = c.split(" ");

and of course that places every character into the array and the last character is “legs!”.

for other purposes i need to split it in every character but how can i now separate the punctuation (in order) so i can recall it later.

thanks. fumeng.

i don’t understand what you’re asking exactly…

:p:

hi. thanks for responding.

i’m just trying to break up a string:


var c:String = "my frog has four legs!"

into a substring.

i’ve already broken it up using:


tempString = c.split(" ");

and that creates an array that looks like this:


tempString = (my,frog,has,four,legs!);

but what i really want in the end is a substring that contains only the punctuation, i.e.


puncString = (!,!,.,?,.);

know what i mean?

couldn’t you use multiple array.split()? like…

my_array.split("!");
my_array.split(".");
my_array.split("?");

it’s bulky, but it would work…

:p: