List of usage examples for java.lang String length
public int length()
From source file:Main.java
public static String FormatBarCode(String barCode) { if (barCode.length() == 13) { Log.i("msg", "barcodeLength==13"); char[] temp = barCode.toCharArray(); return temp[0] + " " + temp[1] + temp[2] + temp[3] + temp[4] + temp[5] + temp[6] + " " + temp[7] + temp[8] + temp[9] + temp[10] + temp[11] + temp[12]; }/*from w ww .j a v a 2 s. c o m*/ Log.i("msg", "barcodeLength!=13"); return barCode; }
From source file:Main.java
private static int skipSpaces(String s, int i) { while (i < s.length() && isSpace(s.charAt(i))) i++;/*from ww w . j a va 2s.c o m*/ return i; }
From source file:Main.java
public static byte[] hexStringToByteArray(String paramString) { int i = paramString.length(); byte[] arrayOfByte = new byte[i / 2]; for (int j = 0; j < i; j += 2) arrayOfByte[(j / 2)] = ((byte) ((Character.digit(paramString.charAt(j), 16) << 4) + Character.digit(paramString.charAt(j + 1), 16))); return arrayOfByte; }
From source file:Main.java
public static boolean isStringInvalid(String str) { if (str == null || str.length() < 1) { return true; }// w w w .j av a2s . co m return false; }
From source file:Main.java
public static Boolean checkUserName(String userName) { if (userName.length() != 11 || !checkPhoneNum(userName)) { return false; }/*from w w w. j a v a 2 s . co m*/ return true; }
From source file:Main.java
public static boolean isBlank(String value) { return value == null || value.length() < 1; }
From source file:Main.java
public static boolean IsStringEmpty(final String s) { return s == null || s.length() == 0; }
From source file:Main.java
public static boolean isNum(String content) { if (content.length() != 6) { return false; }// ww w . j a va 2 s.c o m for (int i = 0; i < content.length(); i++) { char c = content.charAt(i); if (!Character.isDigit(c)) { return false; } } return true; }
From source file:Main.java
public static boolean checkPhone(String phone) { if (phone.length() != 11) { return false; } else {// w ww . jav a 2 s .co m Pattern p = Pattern.compile("^1[3|4|5|7|8]\\d{9}$"); if (p.matcher(phone).matches()) { return true; } else { return false; } } }