is there any method that can check if a character is uppercase or lowercase?
like the method in the String type? (toUpperCase()/toLowerCase());
Printable View
is there any method that can check if a character is uppercase or lowercase?
like the method in the String type? (toUpperCase()/toLowerCase());
Will this do you?
Character (Java Platform SE 6))
// Json
how should i make this ryt?
Code :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); }
Whats the point in checking if its upper case? Just lower case all characters.
Other than that you'd do something like this.
Code :if (Character.isUpperCase(word.charAt(x))) { // Do stuff here }
// Json
tnx sir! thats it.! :)
just want to clarify something..