Alright....solved it myself:
public static function
simpleReplace(source:String,match:String,replace:String):String {
var split:Array = source.split(match);
var newString:String = ''
for (var i:Number = 0; i < split.length; i++) {
newString += split[i]
if (i < split.length - 1) newString += replace;
}
return newString;
}
Possibly not the most elegant...and improvements gleefully accepted.
However, means I can carry on in my reg-ex free existance.
BTW -- Am I the only person who finds reg-ex impossible?
--- In [email protected], "marty.pitt" <[EMAIL PROTECTED]> wrote:
>
> Admission of guilt:
>
> I don't get regular expressions. Never have, never will. I'm missing
> that gene.
>
> But, from what I can tell, reg exp seem to be the ONLY way to do a
> simple replace within in a string. What's the deal?!?
>
> So, I'm struggling with the String.Replace() method in AS3.
>
> Does anyone have a simple replace function along the lines of:
>
> public static function
>
Replace(source:String,valueToMatch:String,valueToReplace:String):String {
> //
> }
>
> Or, is there a similar function hidden somewhere within the AS3 code?
>
> Marty
>