开发者

String replace method not doing anything in Flex 4 app

开发者 https://www.devze.com 2023-01-01 06:45 出处:网络
I have a string called userEmail in my Flex 4 app that has a valu开发者_开发问答e of: my%40email.com

I have a string called userEmail in my Flex 4 app that has a valu开发者_开发问答e 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.


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消