更换口音瓦特/对口AS3 [英] Replacing accents w/ their counterparts in AS3

查看:209
本文介绍了更换口音瓦特/对口AS3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将如何去有关更改éëíïñÑ(等)的同行?也就是说,eeiinN。

How would I go on about changing éëíïñÑ (etc) to their counterparts? ie, eeiinN.

我在想这样做的正则表达式匹配对é - >&功放; eacute;并取代双方及放大器;和急性/严重;空字符串,但我似乎无法找到一个AS3功能连接codeS口音的非数字实体(安培;#234;等等)。我已经使用关联数组,一拉实体[A] =A已经尝试过;不过AS3似乎不喜欢单向code键。

I was thinking about doing regex matching against é -> é and replacing both & and acute/grave; with empty strings, but I can't seem to find an AS3 function that encodes accents to their non-numerical entities (ê and the like). I've already tried using an associative array, a la entities["À"] = "A";, but AS3 seems to dislike the unicode keys.

任何建议将是极大的AP preciated。

Any suggestions would be greatly appreciated.

谢谢!

推荐答案

这就是所谓的单code分解,所以你可能需要谷歌为该。但是,如果你正在处理其他语言比你自己的,不这样做。

This is called "unicode decomposition", so you may want to Google for that. However, if you are dealing with languages other than your own, don't do this.

我知道这个想法似乎是合理的英语母语谁知道还有没有其他的语言,但人们对他们来说,这些字符是字母它使多大意义,与瘦肉精替代W与VV,D并以Q啊,会以讲英语的人。

I know the idea seems reasonable to native English speakers who know no other languages, but to people for whom those characters are letters it makes as much sense as replacing "W" with "VV", "d" with "cl" and "Q" with "O," would to an English speaker.

P.S。既然你问:

您可以通过字符$ C $猫()的字符串进行循环,做你的整数数组。但我还是不建议这样做。

You could loop through the string doing charCodeAt() and do your associative array on the integers. But I still don't recommend it.

唐娜的意思是小姐,而是唐娜的意思是甜甜圈。 从德的手段和德的意思是给予。等等,等等。

"Doña" means "lady" but "dona" means "doughnut". "De" means "from" and "dé" means "give". And so on and so forth.

他们不只是普通的信件恼人的flyspecks,其实都是为不同的E和F或P和R。

They aren't just normal letters with annoying flyspecks, they are actually as distinct as "E" and "F" or "P" and "R".

这篇关于更换口音瓦特/对口AS3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆