Hey guys, I need help...
I need to write a program that converts uppercase to lowercase letters in java, in netbeans 5.0, and i have no idea how to do it.
Thank you, i would apreciate your help.
Hey guys, I need help...
I need to write a program that converts uppercase to lowercase letters in java, in netbeans 5.0, and i have no idea how to do it.
Thank you, i would apreciate your help.
In JAVA API when you look up String documentation there is method
toLowerCase() =>> Converts all of the characters in this String to lower case using the rules of the default locale.
String lowerCaseString = mixedCaseString.toLowerCase();
for other info check documentation http://java.sun.com/javase/6/docs/api/java/lang/String.html
I don't know why do this but on personal request here is code
public class LowerCaseChange
{
public static void main(String[] args)
{
String mixed = "ThiS PrograM Is DrivinG me CrAzY, I am New at programming!!";
System.out.println(mixed);
String lowerCaseSet = mixed.toLowerCase();
System.out.println(lowerCaseSet);
}
}
It is so simple...
I don't know why do this but on personal request here is code
public class LowerCaseChange { public static void main(String[] args) { String mixed = "ThiS PrograM Is DrivinG me CrAzY, I am New at programming!!"; System.out.println(mixed); String lowerCaseSet = mixed.toLowerCase(); System.out.println(lowerCaseSet); } }
Hey Pet, look like you are good at this. thank you. But what i have to do it this...
write a program that converts an uppercase letter to a lowercase letter. The character is typed in the source code as a literal value. And i have to use this...
int (offset) = (int) 'a' - (int) 'A' ;
char lowercase = (char)((int)uppercase + offset);I have this already..
import javax.swing.JOptionPane;
public class uppertolower {
public static void main(String args[]) {String uppercaseString = JOptionPane.showInputDialog(null,
"Enter an Uppercase letter to convert: ", JOptionPane.QUESTION_MESSAGE);int offset = (int)'a' - (int)'A';
char lowercase = (char)((int)uppercase + offset);
Then what you are getting from your JOptionPane is a String. You need to convert this String to a char. Here is an example (I am assuming you only have to deal with one letter):
char letter = uppercaseString.toCharArray()[0];
I assume you know what to do with the offset once you have turned the String into a char.
Also, this information is easily found in the String API doc.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.