hi,
i"m trying to fint if a string starts(first letter) width an RTL language/ hebrew.
any ideas?
hi,
i"m trying to fint if a string starts(first letter) width an RTL language/ hebrew.
any ideas?
This will find hebrew letters encoded in the Hebrew Unicode code point range: [\u0590-\u05FF]
if (str.charCodeAt(0) > 0x590) && (str.charCodeAt(0) < 0x5FF) then
it is most probably a hebrew character
JavaScript does not support regex scripts like \p{InHebrew}
(or something similar). However, it does support Unicode escapes, so you could use a regex like:
/[\u0590–\u05FF]/
which will match a single Hebrew character.
See: http://unicode.org/charts/PDF/U0590.pdf and: http://www.regular-expressions.info/unicode.html