@Test public void testIsJavaIdentifier() { assertTrue("Abcd is a java identifier", StringUtil.isJavaIdentifier("Abcd")); assertFalse("1Abcd is not a java identifier", StringUtil.isJavaIdentifier("1Abcd")); assertFalse("Ab+cd is not a java identifier", StringUtil.isJavaIdentifier("Ab+cd")); }
public static boolean isJavaIdentifier(String str){ if (str == null || str.length() < 1 || !Character.isJavaIdentifierStart(str.charAt(0))) return false; for (int i=1; i<str.length(); i++){ if (!Character.isJavaIdentifierPart(str.charAt(i))) return false; } return true; }
StringUtil { public static boolean isJavaIdentifier(String str){ if (str == null || str.length() < 1 || !Character.isJavaIdentifierStart(str.charAt(0))) return false; for (int i=1; i<str.length(); i++){ if (!Character.isJavaIdentifierPart(str.charAt(i))) return false; } return true; } }
StringUtil { public static boolean isJavaIdentifier(String str){ if (str == null || str.length() < 1 || !Character.isJavaIdentifierStart(str.charAt(0))) return false; for (int i=1; i<str.length(); i++){ if (!Character.isJavaIdentifierPart(str.charAt(i))) return false; } return true; }  }
StringUtil { public static boolean isJavaIdentifier(String str){ if (str == null || str.length() < 1 || !Character.isJavaIdentifierStart(str.charAt(0))) return false; for (int i=1; i<str.length(); i++){ if (!Character.isJavaIdentifierPart(str.charAt(i))) return false; } return true; }  static boolean isEmpty(String str); static String getLeft(String src, int length); static String getRight(String src, int length); static boolean isDigitOnly(String chkStr); static String SQLEscape(String str); static String fillString(String str, int length, char fillChar, boolean fillLeft); static String cEscape(String str); static String cEscape(String str, char quoteChar); static String cEscape(String str, char quoteChar, boolean isWchar); static String lowerFirst(String str); static String upperFirst(String str); static boolean isJavaIdentifier(String str); static int[] splitAsIntArray(String str, String delimiter); static String join(byte[] items, String delimiter); static String join(String[] items, String delimiter); static String join(List<String> items, String delimiter); static StringBuilder appendRepeatedly(StringBuilder result, String str, int times); static StringBuilder appendRepeatedly(StringBuilder result, char c, int times); static String toTrimmedStr(Object o, int len); }
StringUtil { public static boolean isJavaIdentifier(String str){ if (str == null || str.length() < 1 || !Character.isJavaIdentifierStart(str.charAt(0))) return false; for (int i=1; i<str.length(); i++){ if (!Character.isJavaIdentifierPart(str.charAt(i))) return false; } return true; }  static boolean isEmpty(String str); static String getLeft(String src, int length); static String getRight(String src, int length); static boolean isDigitOnly(String chkStr); static String SQLEscape(String str); static String fillString(String str, int length, char fillChar, boolean fillLeft); static String cEscape(String str); static String cEscape(String str, char quoteChar); static String cEscape(String str, char quoteChar, boolean isWchar); static String lowerFirst(String str); static String upperFirst(String str); static boolean isJavaIdentifier(String str); static int[] splitAsIntArray(String str, String delimiter); static String join(byte[] items, String delimiter); static String join(String[] items, String delimiter); static String join(List<String> items, String delimiter); static StringBuilder appendRepeatedly(StringBuilder result, String str, int times); static StringBuilder appendRepeatedly(StringBuilder result, char c, int times); static String toTrimmedStr(Object o, int len);  }