Ok guys, I need help, I found a couple of examples but don't understand. None of the Java examples uses this method for Converting letters uppercase to lowercase:

int offset = (int) 'a' -(int) 'A';
char lowercase = (char)((int)uppercase + offset);

Can somebody get me on the right track here because I'm stuck after public static void main(String [] args). I just need somebody to get me on the right track. Thanks. Seems like this was the only thing that wasn't explained at all in the Java textbook and the Java for dummies series.

9 Years
Discussion Span
Last Post by Ezzaral

Hmm ok, but another question, how would I do a single line for assigning all the letters A throw Z instead of making a command with 26 different lines of codes, in other words, shorting it up?

// to convert an entire string
String lowercaseString = originalString.toLowerCase();

You don't need 26 lines. You just call the toLowerCase() function on the string itself. That string can be a single letter or many letters.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.