views:

145

answers:

1

I have a string called userEmail in my Flex 4 app that has a value of:

my%40email.com

I need to have an @ symbol instead of %40, so I run this line:

userEmail.replace("%40","@");

But the string has the same value after. What am I doing wrong?

Thanks for reading.

+1  A: 

That's because replace is not an in-situ function. It returns a new string with the changed value. Try:

userMail = userEmail.replace("%40","@");

instead.

See here for the gruesome details (here for flex4 but it appears to be the same).

paxdiablo
Ah my brain must still be sleeping to not think of that! Thanks so much for your help.
ben