开发者

How to determine if string contains arabic symbols?

I need to know, If the string is in Arabic to change the layout of my html page. How do I开发者_开发知识库 do this?


With latest ruby (at least 2.0.0 I think) also string =~ /\p{Arabic}/ will work


You should be able to use a Unicode regular expression (example of Unicode in a Ruby regex) to check for the presence of Unicode Arabic characters.


You can try this gem https://github.com/peterc/whatlanguage

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜