Java ASCII from toAscii(String s)

Here you can find the source of toAscii(String s)

Description

to Ascii

License

Open Source License

Declaration

public static String toAscii(String s) 

Method Source Code

//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();
    }
}

Related

  1. toAscii(int number)
  2. toAscii(String hexStr)
  3. toAscii(String notAscii)
  4. toAscii(String s)
  5. toAscii(String s)
  6. toASCII(String s)
  7. toASCII(String str)
  8. toAsciiArray(char[] carr)
  9. toAsciiByteArray(final char[] carr)