public class Faith extends Object
| 限定符和类型 | 字段和说明 |
|---|---|
private static char[] |
DIGITS
All possible chars for representing a number as a String
|
| 构造器和说明 |
|---|
Faith() |
| 限定符和类型 | 方法和说明 |
|---|---|
static boolean |
allEmpty(Object... os)
对象组中是否全是 Empty Object
|
static StringBuilder |
appendBuilder(StringBuilder sb,
CharSequence... strs)
创建StringBuilder对象
|
private static boolean |
arrayEquals(Object o1,
Object o2)
Compare the given arrays with
Arrays.equals, performing an equality
check based on the array elements rather than the array reference. |
static String |
cleanIdentifier(String param)
获取标识符,用于参数清理
|
static boolean |
equals(Object obj1,
Object obj2)
比较两个对象是否相等。
|
static boolean |
equalsSafe(Object o1,
Object o2)
Determine if the given objects are equal, returning
true if
both are null or false if only one is null. |
static boolean |
hasEmpty(Object... os)
对象组中是否存在 Empty Object
|
static boolean |
isAnyBlank(CharSequence... css)
有 任意 一个 Blank
|
static boolean |
isBlank(CharSequence cs)
Check whether the given
CharSequence contains actual text. |
static boolean |
isEmpty(Object obj)
Determine whether the given object is empty:
i.e.
|
static boolean |
isEmpty(Object[] array)
Determine whether the given array is empty:
i.e.
|
static boolean |
isNoneBlank(CharSequence... css)
是否全非 Blank
|
static boolean |
isNotBlank(CharSequence cs)
Checks if a CharSequence is not empty (""), not null and not whitespace only.
|
static boolean |
isNotEmpty(Object obj)
Determine whether the given object is not empty:
i.e.
|
static boolean |
isNotEmpty(Object[] array)
判断数组不为空
|
static boolean |
nullSafeEquals(Object o1,
Object o2)
Determine if the given objects are equal, returning
true if
both are null or false if only one is null. |
static String |
to62String(long i)
将 long 转短字符串 为 62 进制
|
static Boolean |
toBoolean(Object value)
Convert a
String to an Boolean, returning a
default value if the conversion fails. |
static Boolean |
toBoolean(Object value,
Boolean defaultValue)
Convert a
String to an Boolean, returning a
default value if the conversion fails. |
static Double |
toDouble(Object value)
Convert a
String to an Double, returning a
default value if the conversion fails. |
static Double |
toDouble(Object value,
Double defaultValue)
Convert a
String to an Double, returning a
default value if the conversion fails. |
static Double |
toDouble(String value)
Convert a
String to a Double |
static Double |
toDouble(String value,
Double defaultValue)
Convert a
String to a Double |
static Float |
toFloat(Object value)
Convert a
String to an Float, returning a
default value if the conversion fails. |
static Float |
toFloat(Object value,
Float defaultValue)
Convert a
String to an Float, returning a
default value if the conversion fails. |
static Float |
toFloat(String value)
Convert a
String to a Double |
static Float |
toFloat(String value,
Float defaultValue)
Convert a
String to a Double |
static int |
toInt(Object value)
Convert a
String to an int, returning
zero if the conversion fails. |
static int |
toInt(Object value,
int defaultValue)
Convert a
String to an int, returning a
default value if the conversion fails. |
static int |
toInt(String str)
Convert a
String to an int, returning
zero if the conversion fails. |
static int |
toInt(String str,
int defaultValue)
Convert a
String to an int, returning a
default value if the conversion fails. |
static long |
toLong(Object value)
Convert a
String to a long, returning
zero if the conversion fails. |
static long |
toLong(Object value,
long defaultValue)
Convert a
String to a long, returning a
default value if the conversion fails. |
static long |
toLong(String str)
Convert a
String to a long, returning
zero if the conversion fails. |
static long |
toLong(String str,
long defaultValue)
Convert a
String to a long, returning a
default value if the conversion fails. |
static String |
toStr(Object str)
强转string,并去掉多余空格
|
static String |
toStr(Object str,
String defaultValue)
强转string,并去掉多余空格
|
static String[] |
toStrArray(String str)
转换为String数组
|
static String[] |
toStrArray(String split,
String str)
转换为String数组
|
private static final char[] DIGITS
public static String toStr(Object str, String defaultValue)
str - 字符串defaultValue - 默认值public static int toInt(Object value)
Convert a String to an int, returning
zero if the conversion fails.
If the string is null, zero is returned.
$.toInt(null) = 0
$.toInt("") = 0
$.toInt("1") = 1
value - the string to convert, may be nullzero if
conversion failspublic static int toInt(Object value, int defaultValue)
Convert a String to an int, returning a
default value if the conversion fails.
If the string is null, the default value is returned.
$.toInt(null, 1) = 1
$.toInt("", 1) = 1
$.toInt("1", 0) = 1
value - the string to convert, may be nulldefaultValue - the default valuepublic static Double toDouble(Object value)
Convert a String to an Double, returning a
default value if the conversion fails.
If the string is null, the default value is returned.
$.toDouble(null, 1) = 1.0
$.toDouble("", 1) = 1.0
$.toDouble("1", 0) = 1.0
value - the string to convert, may be nullpublic static Double toDouble(Object value, Double defaultValue)
Convert a String to an Double, returning a
default value if the conversion fails.
If the string is null, the default value is returned.
$.toDouble(null, 1) = 1.0
$.toDouble("", 1) = 1.0
$.toDouble("1", 0) = 1.0
value - the string to convert, may be nulldefaultValue - the default valuepublic static long toLong(Object value)
Convert a String to a long, returning
zero if the conversion fails.
If the string is null, zero is returned.
$.toLong(null) = 0L
$.toLong("") = 0L
$.toLong("1") = 1L
value - the string to convert, may be null0 if
conversion failspublic static long toLong(Object value, long defaultValue)
Convert a String to a long, returning a
default value if the conversion fails.
If the string is null, the default value is returned.
$.toLong(null, 1L) = 1L
$.toLong("", 1L) = 1L
$.toLong("1", 0L) = 1L
value - the string to convert, may be nulldefaultValue - the default valuepublic static int toInt(String str)
Convert a String to an int, returning
zero if the conversion fails.
If the string is null, zero is returned.
NumberUtil.toInt(null) = 0
NumberUtil.toInt("") = 0
NumberUtil.toInt("1") = 1
str - the string to convert, may be nullzero if
conversion failspublic static int toInt(@Nullable
String str,
int defaultValue)
Convert a String to an int, returning a
default value if the conversion fails.
If the string is null, the default value is returned.
NumberUtil.toInt(null, 1) = 1
NumberUtil.toInt("", 1) = 1
NumberUtil.toInt("1", 0) = 1
str - the string to convert, may be nulldefaultValue - the default valuepublic static long toLong(String str)
Convert a String to a long, returning
zero if the conversion fails.
If the string is null, zero is returned.
NumberUtil.toLong(null) = 0L
NumberUtil.toLong("") = 0L
NumberUtil.toLong("1") = 1L
str - the string to convert, may be null0 if
conversion failspublic static long toLong(@Nullable
String str,
long defaultValue)
Convert a String to a long, returning a
default value if the conversion fails.
If the string is null, the default value is returned.
NumberUtil.toLong(null, 1L) = 1L
NumberUtil.toLong("", 1L) = 1L
NumberUtil.toLong("1", 0L) = 1L
str - the string to convert, may be nulldefaultValue - the default valuepublic static Double toDouble(String value)
Convert a String to a Double
value - valuepublic static Double toDouble(@Nullable String value, Double defaultValue)
Convert a String to a Double
value - valuedefaultValue - 默认值public static Float toFloat(String value)
Convert a String to a Double
value - valuepublic static Float toFloat(@Nullable String value, Float defaultValue)
Convert a String to a Double
value - valuedefaultValue - 默认值public static Float toFloat(Object value)
Convert a String to an Float, returning a
default value if the conversion fails.
If the string is null, the default value is returned.
$.toFloat(null, 1) = 1.00f
$.toFloat("", 1) = 1.00f
$.toFloat("1", 0) = 1.00f
value - the string to convert, may be nullpublic static Float toFloat(Object value, Float defaultValue)
Convert a String to an Float, returning a
default value if the conversion fails.
If the string is null, the default value is returned.
$.toFloat(null, 1) = 1.00f
$.toFloat("", 1) = 1.00f
$.toFloat("1", 0) = 1.00f
value - the string to convert, may be nulldefaultValue - the default valuepublic static Boolean toBoolean(Object value)
Convert a String to an Boolean, returning a
default value if the conversion fails.
If the string is null, the default value is returned.
$.toBoolean("true", true) = true
$.toBoolean("false") = false
$.toBoolean("", false) = false
value - the string to convert, may be nullpublic static Boolean toBoolean(Object value, Boolean defaultValue)
Convert a String to an Boolean, returning a
default value if the conversion fails.
If the string is null, the default value is returned.
$.toBoolean("true", true) = true
$.toBoolean("false") = false
$.toBoolean("", false) = false
value - the string to convert, may be nulldefaultValue - the default valuepublic static String to62String(long i)
i - 数字public static boolean isEmpty(@Nullable
Object obj)
null or of zero length.obj - the object to checkpublic static boolean isNotEmpty(@Nullable
Object obj)
null or of zero length.obj - the object to checkpublic static boolean isNotEmpty(@Nullable
Object[] array)
array - 数组public static boolean isEmpty(@Nullable
Object[] array)
null or of zero length.array - the array to checkpublic static boolean hasEmpty(Object... os)
os - 对象组public static boolean allEmpty(Object... os)
os - 对象组public static boolean isBlank(@Nullable
CharSequence cs)
CharSequence contains actual text.
More specifically, this method returns true if the
CharSequence is not null, its length is greater than
0, and it contains at least one non-whitespace character.
$.isBlank(null) = true
$.isBlank("") = true
$.isBlank(" ") = true
$.isBlank("12345") = false
$.isBlank(" 12345 ") = false
cs - the CharSequence to check (may be null)true if the CharSequence is not null,
its length is greater than 0, and it does not contain whitespace onlyCharacter.isWhitespace(char)public static boolean isNotBlank(@Nullable
CharSequence cs)
Checks if a CharSequence is not empty (""), not null and not whitespace only.
$.isNotBlank(null) = false
$.isNotBlank("") = false
$.isNotBlank(" ") = false
$.isNotBlank("bob") = true
$.isNotBlank(" bob ") = true
cs - the CharSequence to check, may be nulltrue if the CharSequence is
not empty and not null and not whitespaceCharacter.isWhitespace(char)public static boolean isAnyBlank(CharSequence... css)
css - CharSequencepublic static boolean isNoneBlank(CharSequence... css)
css - CharSequencepublic static boolean equals(Object obj1, Object obj2)
obj1 - 对象1obj2 - 对象2public static boolean equalsSafe(@Nullable
Object o1,
@Nullable
Object o2)
true if
both are null or false if only one is null.
Compares arrays with Arrays.equals, performing an equality
check based on the array elements rather than the array reference.
o1 - first Object to compareo2 - second Object to compareObject.equals(Object),
Arrays.equals(long[], long[])public static StringBuilder appendBuilder(StringBuilder sb, CharSequence... strs)
sb - 初始StringBuilderstrs - 初始字符串列表public static String[] toStrArray(String split, String str)
split - 分隔符str - 被转换的值@Nullable public static String cleanIdentifier(@Nullable String param)
param - 参数public static boolean nullSafeEquals(@Nullable
Object o1,
@Nullable
Object o2)
true if
both are null or false if only one is null.
Compares arrays with Arrays.equals, performing an equality
check based on the array elements rather than the array reference.
o1 - first Object to compareo2 - second Object to compareObject.equals(Object),
Arrays.equals(long[], long[])private static boolean arrayEquals(Object o1, Object o2)
Arrays.equals, performing an equality
check based on the array elements rather than the array reference.o1 - first array to compareo2 - second array to comparenullSafeEquals(Object, Object),
Arrays.equals(long[], long[])Copyright © 2024. All rights reserved.