List of usage examples for java.lang String charAt
public char charAt(int index)
From source file:Main.java
public static int osType(String type) { int result;// www . j a v a 2 s .c o m result = (type.charAt(0) & 0xff) << 24; result |= (type.charAt(1) & 0xff) << 16; result |= (type.charAt(2) & 0xff) << 8; result |= (type.charAt(3) & 0xff); return result; }
From source file:Main.java
private static int skipSpaces(String s, int i) { while (i < s.length() && isSpace(s.charAt(i))) i++;// w w w .j a v a 2 s.c o m return i; }
From source file:Main.java
private static String trim(String text) { if (text != null && text.length() > 1 && text.charAt(0) == '[') { text = text.substring(1);/* w w w . j av a2s . c o m*/ } return text; }
From source file:Main.java
/** * checks if a condition is true/* w w w . ja v a 2s . co m*/ * * @param condition value of the condition attribute * @return result of the evaluation of the condition */ public static boolean checkCondition(String condition) { if ((condition == null) || condition.trim().equals("")) { return true; } String value = condition.trim(); if (value.charAt(0) == '!') { return System.getProperty(value.substring(1)) == null; } return System.getProperty(value) != null; }
From source file:Main.java
public static String getClassName(String signature) { String clsName = signature.replaceAll("/", "."); if (clsName.charAt(0) == 'L' && clsName.charAt(clsName.length() - 1) == ';') { return clsName.substring(1, clsName.length() - 1); }//from ww w . j ava 2 s. c om return clsName; }
From source file:Main.java
private static void appendHex(StringBuffer sb, byte b) { final String HEX = "0123456789ABCDEF"; sb.append(HEX.charAt((b >> 4) & 0x0f)).append(HEX.charAt(b & 0x0f)); }
From source file:Main.java
public static boolean checkIsParaEnd(String line) { if (line != null && !"".equals(line) && line.charAt(0) == BLANK) return true; return false; }
From source file:Main.java
private static boolean validatePin(String pin) { if (pin.length() == 4 && isDigit(pin.charAt(0)) && isDigit(pin.charAt(1)) && isDigit(pin.charAt(2)) && isDigit(pin.charAt(3))) { return true; } else {/*from ww w .j a va 2s. c om*/ return false; } }
From source file:Main.java
public static String removeChar(String s, char c) { String r = ""; for (int i = 0; i < s.length(); i++) { if (s.charAt(i) != c) r += s.charAt(i);// w w w.j a v a 2s . c om } return r; }
From source file:Main.java
public static String capitalize(final String line) { return Character.toUpperCase(line.charAt(0)) + line.substring(1); }