Ok, long story short, i need a way to replace characters throughout a whole string. What i am doing, is loading a big article that is inside an xml attribute (the blah="" tag thing). I am doing various things with the article, such as splitting it up to be in pages, ect.

My problem lies in the fact that xml hates html tags format.. as they seem to be the same thing basically, so what i am wanting is a way to replace a few key characters that html goes by.

In otherwords, i need to write stuff like <a href="asfunction:blah,blah">Link</a>, ect in an xml file. But since i dont see a way to do that, i am going to write it with different characters; Something XML is happy with. For example
Code:
(,)a href=(')asfunction:blah,blah(')(.)Link(,)/a(.)
Now i know that looks insanely weird, and i'll prob use dif characters, but what i am doing is replacing anything XML might not like (i cant remember if it doesent like " or not) with my own custom character.

Now to get to what this post is about, what do you think would be the best way to replace the characters? I may be missing some simple way around this, so please correct me if i am.

But what i plan on doing, is building a custom replace function with some String features. Say you want to replace all instances of (,) with < after loading the XML Node Attribute into a String. What i am going to do is make my function hold a Variable for completed string, temp string, and old string.

Apon the function being called, it takes a parameter of a string, searches via String.indexOf, for the first instance of (,). Once it finds an instance you log what number it starts at, lets say it starts at 51 characters in. It then takes characters 0-50, puts them in the finalized string, adds the replace character <, takes out the (,) from the front of the temp string, which leaves characters 54 and on. so then it does the same thing, searches via indexOf, for (,) and if it finds anything, it does it all over again.


Mostly i am wondering is this the best way to do this in flash? It will get the job done, but seeing as i am be searching big big strings, full blown articles, i want to make sure i wont bog it down completely. Or who knows, i dont know flash that well so there may be something built in to do this, i just didnt see it in "String".


Thanks to any comments, and hopefully you understand what i am trying to say lol.