List of usage examples for java.lang Character toString
public static String toString(int codePoint)
From source file:Main.java
private static ArrayList<String> getThreegramm(String word) { ArrayList<String> result = new ArrayList<>(); if (word.length() > 2) { for (int i = 0; i < word.length() - 2; i++) { result.add(Character.toString(word.charAt(i)) + Character.toString(word.charAt(i + 1)) + Character.toString(word.charAt(i + 2))); }/*from w w w . jav a 2 s . co m*/ } return result; }
From source file:Main.java
public static String getNumberFromCode(String code) { char codeArray[] = code.toCharArray(); String numbers = ""; for (int i = 0; i < codeArray.length; i++) { int intNumber = (int) codeArray[i] - 1632; numbers += Character.toString((char) (intNumber + 48)); }/*from w w w.ja v a 2s . c o m*/ return numbers; }
From source file:Main.java
public static String getCodeFromNumber(String number) { char[] numberArray = number.toCharArray(); String character = ""; for (int i = 0; i < numberArray.length; i++) { int intNumber = ((int) numberArray[i] - 48); character += Character.toString((char) (intNumber + 1632)); }// w ww .j a v a2 s .c om return character; }
From source file:Main.java
public static boolean argEquals(String string, String string2) { if (string.toLowerCase().equals(string2.toLowerCase())) return true; StringBuilder sb = new StringBuilder(); for (char c : string2.toCharArray()) { String h = Character.toString(c); if (h.toUpperCase().equals(h)) { sb.append(h);/*ww w . j a va 2 s . c o m*/ } } if (sb.toString().toLowerCase().equals(string.toLowerCase())) return true; return false; }
From source file:Main.java
/** * Transform the raw ASCIIs to String by its value. * //w ww .j a v a 2s.c o m * e.g. if ASCII = "97", the result is "a". * * @param ASCII the raw ASCII require transforming * @return the String by its value */ public static String ascii2String(String ASCII) { return Character.toString(__ascii2Char(Integer.parseInt(ASCII))); }
From source file:Main.java
public static String cleanUpTagsString(String paramString) { int i = 0;//from www . j a va 2 s.c om String[] arrayOfString = new String[1]; arrayOfString[0] = "FF0C"; String str = ""; int j = arrayOfString.length; while (i < j) { str = paramString.replaceAll(Character.toString((char) Integer.parseInt(arrayOfString[i], 16)), ","); i += 1; } return str; }
From source file:Main.java
public static String encodeEntity(int entity) { if (entities.containsKey(entity)) return entities.get(entity); if (entity < 128) return Character.toString((char) entity); if (entity < 10000) return "&#" + entity + ";"; else//w w w . j a va 2 s . c o m return "&#x" + Integer.toHexString(entity) + ";"; }
From source file:Main.java
public static List<String> listDesc(String desc) { List<String> list = new ArrayList<String>(5); char[] chars = desc.toCharArray(); int i = 0;/*from w ww . j a v a2 s .c om*/ while (i < chars.length) { switch (chars[i]) { case 'V': case 'Z': case 'C': case 'B': case 'S': case 'I': case 'F': case 'J': case 'D': list.add(Character.toString(chars[i])); i++; break; case '[': { int count = 1; while (chars[i + count] == '[') { count++; } if (chars[i + count] == 'L') { count++; while (chars[i + count] != ';') { count++; } } count++; list.add(new String(chars, i, count)); i += count + 1; break; } case 'L': { int count = 1; while (chars[i + count] != ';') { ++count; } count++; list.add(new String(chars, i, count)); i += count + 1; break; } default: } } return list; }
From source file:Main.java
private static int findTypeEnd(@Nonnull String str, int index) { char c = str.charAt(index); switch (c) {// w ww. ja v a2 s .co m case 'Z': case 'B': case 'S': case 'C': case 'I': case 'J': case 'F': case 'D': return index + 1; case 'L': while (str.charAt(index++) != ';') { } return index; case '[': while (str.charAt(index++) != '[') { } return findTypeEnd(str, index); default: throw new IllegalArgumentException(String.format("Param string \"%s\" contains invalid type prefix: %s", str, Character.toString(c))); } }
From source file:Main.java
public static String unescapeXML(final String xml) { Pattern xmlEntityRegex = Pattern.compile("&(#?)([^;]+);"); //Unfortunately, Matcher requires a StringBuffer instead of a StringBuilder StringBuffer unescapedOutput = new StringBuffer(xml.length()); Matcher m = xmlEntityRegex.matcher(xml); Map<String, String> builtinEntities = null; String entity;// w ww. j av a2s . co m String hashmark; String ent; int code; while (m.find()) { ent = m.group(2); hashmark = m.group(1); if ((hashmark != null) && (hashmark.length() > 0)) { code = Integer.parseInt(ent); entity = Character.toString((char) code); } else { //must be a non-numerical entity if (builtinEntities == null) { builtinEntities = buildBuiltinXMLEntityMap(); } entity = builtinEntities.get(ent); if (entity == null) { //not a known entity - ignore it entity = "&" + ent + ';'; } } m.appendReplacement(unescapedOutput, entity); } m.appendTail(unescapedOutput); return unescapedOutput.toString(); }