return type is char. If char is already uppercase then it will return same. Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 package org.arpit.java2blog; public class JavaToUpperCaseMain { public static void main(String[] args) { System.out.println(Character.toUpperCase('a')); ...
importorg.apache.commons.lang3.StringUtils;publicclassCharUpperLowerCase{publicstaticvoidmain(String[]args){charchar1,char2;String string1="a";String string2="B";String string1UpperCase=StringUtils.capitalize(string1);String string2LowerCase=StringUtils.lowerCase(string2);char1=string1UpperCase.charAt...
static char toUpperCase(char ch)converts to uppercase. static char toLowerCase(char ch)converts to lowercase. publicclassMain{publicstaticvoidmain(String[] argv){ System.out.println(Character.toTitleCase('a')); System.out.println(Character.toUpperCase('a')); System.out.println(Character.toLowe...
Convert the first character to uppercase Convert the rest of the string to lowercase Append the result toStringBufferfollowed by space(”“) or delimiter Return the result string publicstaticStringtitleCase(StringinputString){if(StringUtils.isBlank(inputString)){return"";}if(StringUtils.length(inputS...
Converts the character (Unicode code point) argument to titlecase using case mapping information from the UnicodeData file. If a character has no explicit titlecase mapping and is not itself a titlecase char according to UnicodeData, then the uppercase mapping is returned as an equivalent titleca...
public String(char[] value, int offset, int count) Allocates a new String that contains characters from a subarray of the character array argument. The offset argument is the index of the first character of the subarray and the count argument specifies the length of the subarray. The con...
* Utility method to take a string and convert it to normal Java variable * name capitalization. This normally means converting the first * character from upper case to lower case, but in the (unusual) special * case when there is more than ...
Java Data Type String char Convert Characters to Lower Case public class Main { public static void main(String[] args) { String str = "This Is a Test"; str = str.toLowerCase(); System.out.println(str); } } //this is a test ...
The program prints Z character to the terminal. String word = "ZetCode"; Here we create a string variable and assign it "ZetCode" value. char c = word.charAt(0); ThecharAtmethod returns thecharvalue at the specified index. The first char value of the sequence is at index 0, the next...
}privatestaticStringconvertToCamelCase(Stringkey){StringBuildercamelCaseKey=newStringBuilder();booleannextUpperCase=false;for(inti=0;i<key.length();i++){charc=key.charAt(i);if(c=='_'){nextUpperCase=true;}else{if(nextUpperCase){camelCaseKey.append(Character.toUpperCase(c));nextUpperCase=...