parseInt does not seem to be throwing an exception when I pass a letter of the alphabet to it. I assume this is because ASCII letters are treated as integers. So my question is, is there a method that will do this:

boolean isLetter();

And if not, how do I get around what I said about ASCII (if its even a correct assumption) to write the method myself?

Recommended Answers

All 5 Replies

try this

Character.isLetter('1');

Thanks - much appreciated. I should have just searched isLetter first, but I didn't realize that my guess would be the method name. Lol.

Also, out of curiosity, if anyone knows the method's logic, please tell. I doubt its that complicated, probably a few lines of code.

> I doubt its that complicated, probably a few lines of code.

I doubt it is simple given that the method is Unicode aware hence would involve a lot of Unicode jargon like code points, planes etc. If you are interested, you can take a peek at the source code though without a basic understanding of the Unicode specification, it would be rather pointless.

P.S.: Yay, 7K! :-)

Is that supposed to be a link to the source code - it just looks like an ad? If not, where can I find it? I've heard of unicode, I'll take a peek at the code but I tried to google it and couldn't find it.

Link? I didn't post any link in my previous post; maybe you are talking about IntelliTXT ads. As far as the source code is concerned, look into the installation directory of Java, you will find a src.zip, containing the entire source code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.