本文整理了Java中java.lang.Character.isDigit()
方法的一些代码示例,展示了Character.isDigit()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Character.isDigit()
方法的具体详情如下:
包路径:java.lang.Character
类名称:Character
方法名:isDigit
[英]Indicates whether the specified character is a digit.
[中]指示指定的字符是否为数字。
代码示例来源:origin: google/guava
@Override
public boolean matches(char c) {
return Character.isDigit(c);
}
代码示例来源:origin: libgdx/libgdx
public boolean acceptChar (TextField textField, char c) {
return Character.isDigit(c);
}
}
代码示例来源:origin: libgdx/libgdx
public boolean acceptChar (TextField textField, char c) {
return Character.isDigit(c);
}
}
代码示例来源:origin: prestodb/presto
@Override
public boolean matches(char c) {
return Character.isDigit(c);
}
代码示例来源:origin: apache/incubator-dubbo
public static boolean isNumeric(String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
代码示例来源:origin: apache/incubator-dubbo
public static boolean isNumeric(String str) {
if (str == null) {
return false;
}
int sz = str.length();
for (int i = 0; i < sz; i++) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
代码示例来源:origin: stackoverflow.com
public static boolean isNumeric(String str)
{
for (char c : str.toCharArray())
{
if (!Character.isDigit(c)) return false;
}
return true;
}
代码示例来源:origin: apache/incubator-dubbo
private static String getDigital(String v) {
int index = 0;
for (int i = 0; i < v.length(); i++) {
char c = v.charAt(i);
if (Character.isDigit(c)) {
if (i == v.length() - 1) {
index = i + 1;
} else {
index = i;
}
} else {
index = i;
break;
}
}
return v.substring(0, index);
}
代码示例来源:origin: apache/incubator-dubbo
private static String getDigital(String v) {
int index = 0;
for (int i = 0; i < v.length(); i++) {
char c = v.charAt(i);
if (Character.isDigit(c)) {
if (i == v.length() - 1) {
index = i + 1;
} else {
index = i;
}
} else {
index = i;
break;
}
}
return v.substring(0, index);
}
代码示例来源:origin: spring-projects/spring-framework
@Override
public Instant parse(String text, Locale locale) throws ParseException {
if (text.length() > 0 && Character.isDigit(text.charAt(0))) {
// assuming UTC instant a la "2007-12-03T10:15:30.00Z"
return Instant.parse(text);
}
else {
// assuming RFC-1123 value a la "Tue, 3 Jun 2008 11:05:30 GMT"
return Instant.from(DateTimeFormatter.RFC_1123_DATE_TIME.parse(text));
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
protected static boolean containsNumber(String s) {
if (s == null) {
return false;
}
for (int i = 0, len = s.length(); i < len; i++) {
if (Character.isDigit(s.charAt(i))) {
return true;
}
}
return false;
}
代码示例来源:origin: stanfordnlp/CoreNLP
private static boolean isDigits(String in) {
for (int i = 0, len = in.length(); i < len; i++) {
if ( ! Character.isDigit(in.charAt(i))) {
return false;
}
}
return true;
}
代码示例来源:origin: spring-projects/spring-framework
/**
* Determine whether the given method is a CGLIB 'renamed' method,
* following the pattern "CGLIB$methodName$0".
* @param renamedMethod the method to check
* @see org.springframework.cglib.proxy.Enhancer#rename
*/
public static boolean isCglibRenamedMethod(Method renamedMethod) {
String name = renamedMethod.getName();
if (name.startsWith(CGLIB_RENAMED_METHOD_PREFIX)) {
int i = name.length() - 1;
while (i >= 0 && Character.isDigit(name.charAt(i))) {
i--;
}
return ((i > CGLIB_RENAMED_METHOD_PREFIX.length()) &&
(i < name.length() - 1) && name.charAt(i) == '$');
}
return false;
}
代码示例来源:origin: org.apache.commons/commons-lang3
private static boolean withDecimalsParsing(final String str, final int beginIdx) {
int decimalPoints = 0;
for (int i = beginIdx; i < str.length(); i++) {
final boolean isDecimalPoint = str.charAt(i) == '.';
if (isDecimalPoint) {
decimalPoints++;
}
if (decimalPoints > 1) {
return false;
}
if (!isDecimalPoint && !Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
}
代码示例来源:origin: neo4j/neo4j
static int fieldPropertyNumber( String fieldName )
{
int index = 0;
for ( int i = 0; i < fieldName.length() && Character.isDigit( fieldName.charAt( i ) ); i++ )
{
index++;
}
return index == 0 ? 0 : Integer.parseInt( fieldName.substring( 0, index ) );
}
代码示例来源:origin: stanfordnlp/CoreNLP
protected static boolean containsAlphanumeric(String s) {
if (s == null) {
return false;
}
for (int i = 0, len = s.length(); i < len; i++) {
if (Character.isLetter(s.charAt(i)) || Character.isDigit(s.charAt(i))) {
return true;
}
}
return false;
}
代码示例来源:origin: org.springframework/spring-context
@Override
public Instant parse(String text, Locale locale) throws ParseException {
if (text.length() > 0 && Character.isDigit(text.charAt(0))) {
// assuming UTC instant a la "2007-12-03T10:15:30.00Z"
return Instant.parse(text);
}
else {
// assuming RFC-1123 value a la "Tue, 3 Jun 2008 11:05:30 GMT"
return Instant.from(DateTimeFormatter.RFC_1123_DATE_TIME.parse(text));
}
}
代码示例来源:origin: stanfordnlp/CoreNLP
public static Symbol cannonicalSymbol(char ch) {
if (Character.isDigit(ch)) {
return DIGIT; //{ Digits.add(new Character(ch)); return DIGIT; }
}
if (Character.getNumericValue(ch) >= 10 && Character.getNumericValue(ch) <= 35) {
return LETTER; //{ Letters.add(new Character(ch)); return LETTER; }
}
return new Symbol(ch);
}
代码示例来源:origin: redisson/redisson
protected String readNums() {
skipWS();
int pos = in.position();
int ch = in.readChar();
while (Character.isDigit(ch) || ch == '.' || ch == 'E' || ch == 'e' || ch == '+' || ch == '-' || ch == '_') {
ch = in.readChar();
}
in.back(1);
return in.getString(pos, in.position() - pos).replace("_","");
}
代码示例来源:origin: skylot/jadx
private void checkClassName(ClassNode cls) {
ClassInfo classInfo = cls.getClassInfo();
ClassInfo alias = classInfo.getAlias();
String clsName = alias.getShortName();
String newShortName = null;
char firstChar = clsName.charAt(0);
if (Character.isDigit(firstChar)) {
newShortName = Consts.ANONYMOUS_CLASS_PREFIX + clsName;
} else if (firstChar == '$') {
newShortName = "C" + clsName;
}
if (newShortName != null) {
classInfo.rename(cls.root(), alias.makeFullClsName(newShortName, true));
}
if (alias.getPackage().isEmpty()) {
String fullName = alias.makeFullClsName(alias.getShortName(), true);
String newFullName = Consts.DEFAULT_PACKAGE_NAME + "." + fullName;
classInfo.rename(cls.root(), newFullName);
}
}
内容来源于网络,如有侵权,请联系作者删除!