List of usage examples for java.lang String charAt
public char charAt(int index)
From source file:org.jdal.annotation.AnnotatedElementAccessor.java
private static String getPropertyName(String name) { return name.charAt(0) + name.substring(1); }
From source file:Main.java
public static String abbreviate(String text) { String[] words = text.split("\\s"); StringBuilder builder = new StringBuilder(); int i = 0;/* w w w . java 2s . com*/ while (i < words.length && builder.length() < 2) { String word = words[i].trim(); if (word.length() > 0) builder.append(Character.toUpperCase(word.charAt(0))); i++; } return builder.toString(); }
From source file:Main.java
/** * Classify chars in String and put them in lexmap. * @param str String/*from w ww. j av a2 s. co m*/ * @param code code associated to chars in the String */ private static void mapStr(String str, short code) { int c; for (int i = 0; i < str.length(); i++) { c = str.charAt(i); lexmap[c] |= code; } }
From source file:Main.java
public static synchronized String trim(String str) { String temp = str.trim(); int index = 0; for (int i = 0; i < temp.length(); i++) { char ch = temp.charAt(i); if (ch == '.' || ch == '/' || ch == '\\') { index++;/*w ww .j a v a 2 s . c om*/ } else break; } return temp.substring(index, temp.length()); }
From source file:Main.java
public static String getFirstChar(String value) { if (value != null) { for (int i = 0; i < value.length(); i++) { char ch = value.charAt(i); if (Character.isLetter(ch)) { return String.valueOf(ch).toUpperCase(); }/*from w ww.ja v a2s . c o m*/ } } return String.valueOf(" "); }
From source file:Main.java
public static String getMainlineStyleVersionNumber(String peer_id) { boolean two_digit_in_middle = peer_id.charAt(5) == '-'; String middle_part = decodeNumericChar(peer_id.charAt(3)); if (two_digit_in_middle) { middle_part = join(middle_part, decodeNumericChar(peer_id.charAt(4))); }//from w w w . ja va 2 s . com return joinAsDotted(decodeNumericChar(peer_id.charAt(1)), middle_part, decodeNumericChar(peer_id.charAt(two_digit_in_middle ? 6 : 5))); }
From source file:Main.java
public static int convertDOubleToInt(Double value) { String valueString = Double.toString(value); for (int i = 0; i < valueString.length(); i++) { if (valueString.charAt(i) == '.') { valueString = valueString.substring(0, i); break; }//from w ww . j av a 2 s . c om } int valueInteger = Integer.parseInt(valueString); return valueInteger; }
From source file:com.enremmeta.onenow.Utils.java
public static String capitalize(String s) { return Character.toUpperCase(s.charAt(0)) + s.substring(1); }
From source file:Main.java
public static int delimiterOffset(String input, int pos, int limit, char delimiter) { for (int i = pos; i < limit; i++) { if (input.charAt(i) == delimiter) return i; }/* w w w.ja va2 s. co m*/ return limit; }
From source file:Main.java
public static boolean isNumber(String str) { boolean check = true; for (int i = 0; i < str.length(); i++) { if (!Character.isDigit(str.charAt(i))) { check = false;/*from ww w.j ava 2 s . co m*/ break; } } return check; }