开发者

How to determine if string contains arabic symbols?

开发者 https://www.devze.com 2023-03-28 09:09 出处:网络
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 workYou s

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

精彩评论

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