view raw
JVerstry JVerstry - 6 months ago 25
Javascript Question

How to check if character is a letter in Javascript?

I am extracting a character in a Javascript string with:

var first = str.charAt(0);

and I would like to check whether it is a letter. Strangely, it does not seem like such functionality exists in Javascript. At least I cannot find it.

How can I test this?


I believe this plugin has the capabilities you seek: (github link:

With it you can simply match all unicode letters with \p{L}.

Read the header of this source file to see which categories it supports: