PDA

View Full Version : searching strings (and man, have I tried!)


marev
11-06-2001, 01:09 AM
I've spent the past hour searching threads for searching through strings. I hope somebody can shed some light on the subject.
...I'm strung out. (sorry!)

Do we have to write our own functions to search strings?

I've got a string I'm loading from a server, I'm placing tags within it to offset a certain word that will become a variable in the swf. The rest of the text I'll assign to an array.

Now to tell Flash what word it needs to assign the variable to, I'll need to have it search through that string, see the tags, pay attention to the word inbetween them, and set aside the rest in an array. Right?

And there is no established function for searching through strings, so I'll need to write one. (right?)

Jesse
11-06-2001, 08:07 AM
myString = "bleh";
trace (myString.indexOf("e"));
indexOf and lastIndexOf are what you want.. then use substring to rip out the chars between the tags. Read the AS Dictionary entries on indexOf for more info.

marev
11-06-2001, 11:39 PM
I'll bust out and see what I can come up with.

Thanks again!

Marev