public final class NumberKit extends Object
| Modifier and Type | Method and Description |
|---|---|
static BigDecimal |
bigdecimal(Number number) |
static BigDecimal |
bigdecimal(String text) |
static BigInteger |
bigint(Number number) |
static BigInteger |
bigint(String text) |
static Double |
doubler(Number number) |
static Double |
doubler(String text) |
static Float |
floater(Number number) |
static Float |
floater(String text) |
static Integer |
integer(Number number) |
static Integer |
integer(String text) |
static boolean |
isDigit(String text)
字符串是否純數字
不允許負數
|
static boolean |
isDigit(String text,
boolean negative)
字符串是否純數字
是否允許負數
|
static boolean |
isNumber(String text)
字符串是否數字, 支持最高 10 進制
同時支持負數浮點數校驗
|
static Long |
longer(Number number) |
static Long |
longer(String text) |
static Short |
shorter(Number number) |
static Short |
shorter(String text) |
static Number |
to(Number origin,
Class to) |
static <T extends Number> |
to(String text,
Class<T> to) |
public static boolean isNumber(String text)
text - textpublic static boolean isDigit(String text)
NumberKit.isDigit("1"); // true
NumberKit.isDigit("0"); //true
NumberKit.isDigit("-1"); // false
text - textpublic static boolean isDigit(String text, boolean negative)
NumberKit.isDigit("0", false); // true
NumberKit.isDigit("-1", true); // true
NumberKit.isDigit("-1", false); // false
text - textnegative - 是否負數public static BigDecimal bigdecimal(Number number)
public static BigInteger bigint(Number number)
public static BigDecimal bigdecimal(String text)
public static BigInteger bigint(String text)
Copyright © 2019. All rights reserved.