ToUpperCase and toLowerCase problems

Discussion in 'Java' started by jimgym1989, Aug 5, 2008.

  1. jimgym1989

    jimgym1989

    Joined:
    Aug 5, 2008
    Messages:
    2
    import javax.swing.JOptionPane;
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    public class lowercasesandupper {

    public static void main(String[]args)
    {
    String message;
    int i;
    String letter;
    char let;
    message=JOptionPane.showInputDialog("Enter the string: ");
    message.length();

    for(i=0;i<=message.length();i++)
    {
    letter = message.substring(i,i+1);
    //message.charAt(i);
    if(letter == message.toUpperCase())
    {
    System.out.println("Convert: "+letter.toLowerCase());
    }
    else
    {
    System.out.println("Convert: "+letter.toUpperCase());
    }
    }
    }


    }
    /* I've been making this program for almost 3 days but I can't find the right algorithm..I want to convert all lowercase letters in a string to uppercase letters,and vice versa. For example, JIM will be converted to jim or anTHOny will be converted to ANthoNY. what's wrong with my program?*/
    jimgym1989, Aug 5, 2008
    #1
    1. Advertising

  2. jimgym1989

    jimgym1989

    Joined:
    Aug 5, 2008
    Messages:
    2
    Additional Information

    This is Java Programming...
    jimgym1989, Aug 5, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. eduardo.rosa@gmail.com

    toLowerCase and encoding

    eduardo.rosa@gmail.com, Aug 8, 2006, in forum: Java
    Replies:
    2
    Views:
    998
    analu.rosa@gmail.com
    Aug 8, 2006
  2. Susan Baker
    Replies:
    2
    Views:
    800
    kelvSYC
    Jun 26, 2005
  3. Shelly

    Problems, problems for newbie

    Shelly, Sep 2, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    2,166
    Shelly
    Sep 3, 2007
  4. Sak Na rede
    Replies:
    0
    Views:
    402
    Sak Na rede
    Jan 30, 2009
  5. Jimbo

    toUpperCase vs IE

    Jimbo, Dec 7, 2003, in forum: Javascript
    Replies:
    2
    Views:
    107
    Evertjan.
    Dec 7, 2003
Loading...

Share This Page