Bart Van der Donck wrote:
go********@gmail.com wrote:
>Does there exist a portable (cross-browser) way to determine Unicode
attributes of a character in Javascript? I couldn't even find functions
like isUpper or isDigit, but it would be more desirable to have full
(or partial) set of Unicode attributes for a character.
Browsers that support Unicode must have this stuff compiled inside; is
this available to Javascript?
To find out if a string is uppercase:
if (/^[A-Z]+$/.test('ADQ')) { alert('is upper') }
The original poster seems to be looking for something different. Unicode
defines character categories and blocks that contain quite a lot more
letters than the Latin A-Z.
Neither the regular expression language in ECMAScript edition 3 nor the
string functions have much support for that, besides toUpperCase and
toLowerCase respectively toLocaleLowerCase and toLocaleUpperCase going
beyond a-z/A-Z.
Regular expression language in Java or .NET have more support for such
Unicode categories (e.g. \p{Lu} for all upper case letters), with
JavaScript you are currently forced to list the ranges you are
interested in yourself.
--
Martin Honnen
http://JavaScript.FAQTs.com/