Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: char (toUppercase?)

  1. #1
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default char (toUppercase?)

    is there any method that can check if a character is uppercase or lowercase?

    like the method in the String type? (toUpperCase()/toLowerCase());


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: char (toUppercase?)

    Will this do you?

    Character (Java Platform SE 6))

    // Json

  3. #3
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: char (toUppercase?)

    how should i make this ryt?

        private static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
     
        public static void main(String[] args) throws IOException {
     
            String temp = "";
     
            System.out.print("Enter a word: ");
            String word = br.readLine();
     
            for (int x = 0; x <= word.length() - 1; x++) {
     
                temp = temp + word.charAt(x);
     
                // pseudocode:
                /**
                 * if the character at (x) is equal to uppercase,
                 * make it lower cased
                 */
     
                if (word.charAt(x) == Character.UPPERCASE_LETTER) {
     
                    Character.toLowerCase(word.charAt(x));
                }
            }
     
            System.out.println("All Are Lower Cased" + temp);
        }

  4. #4
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: char (toUppercase?)

    Whats the point in checking if its upper case? Just lower case all characters.

    Other than that you'd do something like this.

    if (Character.isUpperCase(word.charAt(x))) {
      // Do stuff here
    }

    // Json

  5. The Following User Says Thank You to Json For This Useful Post:

    chronoz13 (December 12th, 2009)

  6. #5
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: char (toUppercase?)

    tnx sir! thats it.!

    just want to clarify something..

Similar Threads

  1. Convert CHAR to STRING
    By fh84 in forum What's Wrong With My Code?
    Replies: 11
    Last Post: October 29th, 2009, 09:21 PM
  2. Vietnamese Character Problem in JSP Report. Chinese and Thai Char OK
    By mrvora in forum JavaServer Pages: JSP & JSTL
    Replies: 7
    Last Post: October 23rd, 2009, 02:35 AM
  3. Need help with concatenizing char? to string?
    By bh-chobo in forum Java SE APIs
    Replies: 3
    Last Post: October 16th, 2009, 08:40 AM
  4. reading a char with SCANNER
    By lotus in forum Java SE APIs
    Replies: 6
    Last Post: July 29th, 2009, 05:03 AM
  5. Program to convert Hexadecimal to its Character equivalent
    By nathanernest in forum Java Theory & Questions
    Replies: 2
    Last Post: April 8th, 2009, 03:12 AM