List of utility methods to do ASCII from
String | toAscii(byte[] b) to Ascii StringBuffer s = new StringBuffer(); if (b == null) { return ""; for (int i = 0; i < b.length; i++) { if (b[i] != 0) { char in = (char) b[i]; s.append(in); ... |
String | toAscii(byte[] ba) to Ascii StringBuilder sb = new StringBuilder(); for (byte b : ba) { sb.append(Integer.toHexString(0xff & b)); return sb.toString(); |
int | toAscii(char ch) to Ascii if (ch <= 0xFF) { return ch; return 0x3F; |
char | toAscii(char source) to Ascii if (source >= 0xc0 && source <= 0x17f) { return tab00c0.charAt(source - 0xc0); return source; |
String | toAscii(int i, boolean reversed) Given an integer value, reinterpret it as a string stored in four bytes. byte[] bytes = new byte[4]; if (!reversed) { bytes[0] = (byte) (i >> 24); bytes[1] = (byte) ((i << 8) >> 24); bytes[2] = (byte) ((i << 16) >> 24); bytes[3] = (byte) ((i << 24) >> 24); } else { bytes[3] = (byte) (i >> 24); ... |
String | toAscii(int number) Returns an Arabic literal representation of the given number using ASCII-7 characters. return Integer.toString(number);
|
String | toAscii(String hexStr) to Ascii StringBuilder sb = new StringBuilder(""); for (int i = 0; i < hexStr.length(); i += 2) { String str = hexStr.substring(i, i + 2); sb.append((char) Integer.parseInt(str, 16)); return sb.toString(); |
String | toAscii(String notAscii) Changes a non-ascii string into an HTML encoded ascii string. StringBuilder builder = new StringBuilder(); char[] charArray = notAscii.toCharArray(); for (int i = 0; i < charArray.length; ++i) { char a = charArray[i]; if ((int) a > 255) { builder.append("&#" + (int) a + ";"); } else { builder.append(a); ... |
String | toAscii(String s) to Ascii StringBuilder b = new StringBuilder(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (c > 127) { String result = "?"; if (c >= 0x00c0 && c <= 0x00c5) { result = "A"; } else if (c == 0x00c6) { ... |
String | toAscii(String s) Replaces accented characters from a non-null String by their ascii equivalent. StringBuilder sb = new StringBuilder(); int n = s.length(); for (int i = 0; i < n; i++) { char c = s.charAt(i); int pos = UNICODE.indexOf(c); if (pos > -1) { sb.append(PLAIN_ASCII.charAt(pos)); } else { ... |