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
精彩评论