如何将Å,Ä和Ö放入javascript数组中,然后将其与html文本进行比较? [英] How to put Å, Ä and Ö in a javascript array and then compare it with html text?

查看:69
本文介绍了如何将Å,Ä和Ö放入javascript数组中,然后将其与html文本进行比较?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想把Å,Ä和Ö。然后使用html文本比较它们。例如,文本有这些字符,我想使用javascript数组比较我的文本。我正在尝试使用以下代码行生成javascript数组:

I want to put Å, Ä and Ö. And then compare them using html text. For example text has these characters, and i want to compare my text using javascript array. I am trying to make javascript array using following line of code:

 var array = ['Å', 'Ä', 'Ö'];

我甚至尝试过Aring; Ä和Ö。这些代码适用于html但不适用于javascript。我怎样才能做到这一点?提前谢谢。

i even tried Å Ä and Ö. These codes work for html but not javascript. How can i do that? thanks in advance.

推荐答案

不是在数组中存储字符串文字,而是存储它们的unicode表示:

Instead of storing string literals in the array, store their unicode representations:

var myArray = ['\u197', '\u196', '\u214'];

我用此网站将您的ASCII符号转换为unicode。

I used this website to convert your ASCII symbols to unicode.

这篇关于如何将Å,Ä和Ö放入javascript数组中,然后将其与html文本进行比较?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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