Upper Case without using API in Java
In this example, We will show you about, Converting String to Upper Case without using API in Java. The example were tested and output is shared.
#1 Example Program
package com.dineshkrish.string; /** * * @author Dinesh Krishnan * */ public class UpperCaseExample { public static void main(String[] args) { String strValue = "dinesh krishnan"; String upperCase = ""; char[] c = strValue.toCharArray(); for (int i = 0; i < c.length; i++) { int ascii = c[i]; if ((ascii >= 97) && (ascii <= 123)) { upperCase = upperCase + "" + (char) (c[i] - 32) + ""; } else { upperCase = upperCase + "" + (c[i]) + ""; } } // Printing the result System.out.println(upperCase); } }
#2 Output
DINESH KRISHNAN
References
More from my site

Hello, folks, I am a founder of idineshkrishnan.com. I love open source technologies, If you find my tutorials are useful, please consider making donations to these charities.
No responses yet