开发者

Replace diacritic letters with equivalent

开发者 https://www.devze.com 2023-04-06 03:02 出处:网络
I\'m trying to replace: á, ă, â ... with a í, ì, ĭ, î, ǐ, ï, ḯ ... with i ú, ü ... with u And so on.

I'm trying to replace:

á, ă, â ... with a

í, ì, ĭ, î, ǐ, ï, ḯ ... with i

ú, ü ... with u

And so on.

What I am doing now is this: str.replace(/[íìĭîǐïḯ开发者_如何转开发]/gi,'i'.

Also, if I want to match all of them I need to call replace for each grouping.

Is there a better way of doing this?


As far as I know you have to match each group. Take a look into this example, although it is javascript it's very complete script and easy to get it to work in actionscript: http://lehelk.com/2011/05/06/script-to-remove-diacritics/

0

精彩评论

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