List of usage examples for java.lang String length
public int length()
From source file:Main.java
public static boolean az(String var0) { return var0 == null || var0.length() == 0 || var0.trim().isEmpty(); }
From source file:Main.java
public static boolean hasValue(String val) { return (val != null && val.length() > 0); }
From source file:Main.java
public static String getJIDWithoutResource(String jid) { if (jid != null && jid.length() > 0 && jid.lastIndexOf("/") > 1) return jid.substring(0, jid.lastIndexOf("/")); return jid;//from ww w . jav a 2 s .co m }
From source file:Main.java
public static boolean isNullOrEmpty(String val) { return (val == null || val.length() == 0); }
From source file:Main.java
public static byte[] hexStringToByteArray(String s) { int len = s.length(); byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(s.charAt(i), 16) << 4) + Character.digit(s.charAt(i + 1), 16)); }/*from ww w . j av a 2 s . co m*/ return data; }
From source file:Main.java
public static boolean isNotEmpty(String str) { return (str != null && str.length() != 0); }
From source file:Main.java
private static byte[] toByte(String hexString) { int len = hexString.length() / 2; byte[] result = new byte[len]; for (int i = 0; i < len; i++) result[i] = Integer.valueOf(hexString.substring(2 * i, 2 * i + 2), 16).byteValue(); return result; }
From source file:Main.java
private static byte[] str2ByteArray(String hexStr) { int len = hexStr.length() / 2; byte[] arr = new byte[len]; for (int i = 0; i < len; i++) { arr[i] = (byte) Integer.parseInt(hexStr.substring(i * 2, i * 2 + 2), 16); }/*from w ww .ja v a 2 s. c om*/ return arr; }
From source file:Main.java
public static int DEKHash(String str) { int hash = str.length(); for (int i = 0; i < str.length(); i++) { hash = ((hash << 5) ^ (hash >> 27)) ^ str.charAt(i); }/*from ww w . j a v a2 s .c om*/ return (hash & 0x7FFFFFFF); }
From source file:Main.java
public static String removeBraces(String src) { return src.substring(1, src.length() - 1); }