Write code to lowercase All characters in a string by checking ASCII code
//package com.book2s; public class Main { public static void main(String[] argv) { String s = "Book2s.com"; System.out.println(lowcaseAll(s)); }//from w ww . j a v a2s .c o m public static String lowcaseAll(String s) { if (s == null || s.equals("")) { return ""; } StringBuffer sb = new StringBuffer(); char[] c = s.toCharArray(); for (int i = 0; i < c.length; i++) { if (c[i] < 97) { sb.append((c[i] + "").toLowerCase()); } else { sb.append(c[i]); } } return sb.toString(); } }