Results 1 to 2 of 2
  1. #1
    gapper is offline Member
    Join Date
    Jan 2008
    Rep Power

    Default Getting ASCII codes of character

    I am writing a method that will take a character and will check if it lies under ASCII range. I know the ASCII codes range but don't know exactly how to proceed. The method signature is as follows:

    Java Code:
    public static boolean validateCharacter(char a)
    Kindly advice.

  2. #2
    CaptainMorgan's Avatar
    CaptainMorgan is offline Moderator
    Join Date
    Dec 2007
    NewEngland, US
    Rep Power


    If you know the range, you can simply check for the number in that range, for example:
    Java Code:
    1) if char [B]a[/B] is a value between 97 to 122
       i) output "lowercase character" or "in range"
    You could also find an API provided ways to test for these problems.
    Vote for the new slogan to our beloved Java Forums! (closes on September 4, 2008)
    Want to voice your opinion on your IDE/Editor of choice? Vote now!
    Got a little Capt'n in you? (drink responsibly)

Similar Threads

  1. How to obtain ASCII code of a character
    By karma in forum New To Java
    Replies: 4
    Last Post: 07-20-2008, 03:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts