在阿拉伯文本中选择括号 [英] Selecting parenthesis in Arabic text

查看:128
本文介绍了在阿拉伯文本中选择括号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我复制了一些阿拉伯文字并将其粘贴到我的网站上.现在,我想在此阿拉伯文本中选择括号: http://jsfiddle.net/t6Kdc/

I copied some Arabic text and pasted it on my website. Now I want to select the parentheses in this Arabic text : http://jsfiddle.net/t6Kdc/

<span>
    كهيعص ﴿١﴾
</span>

jQuery(function () {    
    var oldHtml = jQuery('span').html();
    var newHtml = oldHtml.replace("(","<span style='color: red'>﴾</span>");
    jQuery('span').html(newHtml);
});

但是由于某种原因,我无法选择它们.为什么?

For some reason though, there's no way I can select them. Why ?

推荐答案

这些不是常规的括号,它们是Unicode中阿拉伯语脚本的括号.它们表示为:

Those are not regular parenthesis, those are parenthesis from Arabic script in Unicode. They are represented as:

U+FD3E ﴾ arabic ornate left parenthesis
U+FD3F ﴿ arabic ornate right parenthesis

(您可以在 Wikipedia上的Unicode阿拉伯语脚本中查看实际的Unicode字符 )

要在jQuery中替换它们,您可以执行以下操作:

To replace them in jQuery, you can do the following:

var newHtml = oldHtml.replace("\ufd3e","<span style='color: red'>(</span>");(替换左括号)

var newHtml = oldHtml.replace("\ufd3f","<span style='color: red'>)</span>");(替换右括号)

这篇关于在阿拉伯文本中选择括号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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