Here you can find the source of toAscii(String s)
public static String toAscii(String s)
//package com.java2s; //License from project: Open Source License public class Main { public static String toAscii(String s) { if (s == null) { return null; }//from w w w . j a v a 2s. com StringBuilder sb = new StringBuilder(s.length()); int n = s.length(); int i = 0; while (i < n) { char c = s.charAt(i); if (c >= 'a' && c <= 'z') { sb.append(c); } if (c >= 'A' && c <= 'Z') { sb.append(c); } i++; } return sb.toString(); } }