mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
isNumber update
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.alibaba.druid.sql.parser;
|
||||
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
|
||||
import static com.alibaba.druid.sql.parser.CharTypes.isFirstIdentifierChar;
|
||||
import static com.alibaba.druid.sql.parser.CharTypes.isIdentifierChar;
|
||||
@@ -1150,7 +1151,7 @@ public class Lexer {
|
||||
|
||||
public BigDecimal decimalValue() {
|
||||
String value = subString(mark, bufPos);
|
||||
if (!StringUtils.isNumeric(value)){
|
||||
if (!NumberUtils.isNumber(value)){
|
||||
throw new ParserException(value+" is not a number!");
|
||||
}
|
||||
return new BigDecimal(value.toCharArray());
|
||||
|
||||
@@ -119,18 +119,4 @@ public class StringUtils {
|
||||
}
|
||||
return h;
|
||||
}
|
||||
|
||||
public static boolean isNumeric(final CharSequence cs) {
|
||||
if (isEmpty(cs)) {
|
||||
return false;
|
||||
}
|
||||
final int sz = cs.length();
|
||||
for (int i = 0; i < sz; i++) {
|
||||
if (!Character.isDigit(cs.charAt(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user