public class StringCastUtil extends Object
| Constructor and Description |
|---|
StringCastUtil() |
| Modifier and Type | Method and Description |
|---|---|
static @NotNull BigDecimal |
asDecimal(String str,
@NotNull BigDecimal elz)
convert to BigDecimal, or elz if fail
|
static double |
asDouble(@Nullable String str,
double elz)
convert to double, or elz if fail
|
static boolean |
asFalse(@Nullable String str)
parse case-insensitive `null`, `empty`, `blank` and `false,f,no,n` to false (BUT return true)
NOTE1, no pass-through relationship with asTrue.
|
static float |
asFloat(@Nullable String str,
float elz)
convert to float, or elz if fail
|
static int |
asInt(@Nullable String str,
int elz)
convert to int, or elz if fail
|
static long |
asLong(@Nullable String str,
long elz)
convert to long, or elz if fail
|
static boolean |
asTrue(@Nullable String str)
parse case-insensitive `true|t|yes|y` to true
Note, no pass-through relationship with asFalse.
|
static @NotNull String |
string(BigDecimal v) |
static String |
string(BigDecimal v,
String elz) |
static @NotNull String |
string(Object v) |
static String |
string(Object v,
String elz) |
public static boolean asTrue(@Nullable
@Nullable String str)
public static boolean asFalse(@Nullable
@Nullable String str)
public static long asLong(@Nullable
@Nullable String str,
long elz)
public static int asInt(@Nullable
@Nullable String str,
int elz)
public static float asFloat(@Nullable
@Nullable String str,
float elz)
public static double asDouble(@Nullable
@Nullable String str,
double elz)
@NotNull public static @NotNull BigDecimal asDecimal(String str, @NotNull @NotNull BigDecimal elz)
@NotNull public static @NotNull String string(BigDecimal v)
@Contract(value="_,!null -> !null") public static String string(BigDecimal v, String elz)
Copyright © 2024. All rights reserved.