提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
小写到大写字符串转换
public class Main { static String LowerToUpper(String s) { /* from 时 代 Java - nowjava.com*/ String result = ""; char c; for (int i = 0; i < s.length(); i++) { c = (char) (s.charAt(i) - 32); // 32=2^5 result += c; // concatenation, append c to result } return result; } public static void main(String[] args) { System.out.println(LowerToUpper("nowjava.com")); } }