The Artima Developer Community
Sponsored Link

Java Answers Forum
character comparisions

1 reply on 1 page. Most recent reply: Dec 9, 2002 6:01 AM by Ugo Posada

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
sean foley

Posts: 3
Nickname: foleysf
Registered: Nov, 2002

character comparisions Posted: Dec 5, 2002 9:31 AM
Reply to this message Reply
Advertisement
I have to deal with character comparisons using the ASCII table
Read in a single keyboard character and display an appropriate message depending on whether it was a letter, a digit or some other type of character. Use a nested else-if statement
Could someone please give a solution for this problem
Thanks
Sean.


Ugo Posada

Posts: 37
Nickname: binaryx
Registered: Dec, 2002

Re: character comparisions Posted: Dec 9, 2002 6:01 AM
Reply to this message Reply
That is quite easy using the java.lang.Character class. It has plenty of useful methods to identify characters kinds, for instance:

static boolean isLetter(char ch)
static boolean isDigit(char ch)

among others.

These methods are static so don't try to instantiate a new Character class in order to use them

Regards.

Ugo Posada

Flat View: This topic has 1 reply on 1 page
Topic: Beans.OCX error Previous Topic   Next Topic Topic: Debugging ?????????

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use