|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectml.shifu.guagua.util.NumberFormatUtils
public final class NumberFormatUtils
Util class to parse int, long or any other type.
| 方法摘要 | |
|---|---|
static double |
getDouble(String str)
Parse string object to double type. |
static double |
getDouble(String str,
boolean required)
Parse string object to double type. |
static double |
getDouble(String str,
boolean required,
double defaultValue)
Parse string object to double type. |
static double |
getDouble(String str,
double defaultValue)
Parse string object to double type. |
static int |
getInt(String str)
Parse string object to int type. |
static int |
getInt(String str,
boolean required)
Parse string object to int type. |
static int |
getInt(String str,
boolean required,
int defaultValue)
Parse string object to int type. |
static int |
getInt(String str,
int defaultValue)
Parse string object to int type. |
static long |
getLong(String str)
Parse string object to long type. |
static long |
getLong(String str,
boolean required)
Parse string object to long type. |
static long |
getLong(String str,
boolean required,
long defaultValue)
Parse string object to long type. |
static long |
getLong(String str,
long defaultValue)
Parse string object to long type. |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 方法详细信息 |
|---|
public static int getInt(String str,
int defaultValue)
str - string needed to be parseddefaultValue - default valuepublic static int getInt(String str)
str - string needed to be parsed
public static int getInt(String str,
boolean required)
str - string needed to be parsedrequired - if required, should be parsed successfully without default value to replace; else use 0 as default
value.
Exception - if invalid format with required set 'true'
public static int getInt(String str,
boolean required,
int defaultValue)
str - string needed to be parsedrequired - if required, should be parsed successfully without default value to replace; else use default value.defaultValue - default value
Exception - if invalid format with required set 'true'
public static long getLong(String str,
long defaultValue)
str - string needed to be parseddefaultValue - default valuepublic static long getLong(String str)
str - string needed to be parsed
public static long getLong(String str,
boolean required)
str - string needed to be parsedrequired - if required, should be parsed successfully without default value to replace
Exception - if invalid format with required set 'true'
public static long getLong(String str,
boolean required,
long defaultValue)
str - string needed to be parsedrequired - if required, should be parsed successfully without default value to replace; else use default value.defaultValue - default value
Exception - if invalid format with required set 'true'
public static double getDouble(String str,
double defaultValue)
str - string needed to be parseddefaultValue - default valuepublic static double getDouble(String str)
str - string needed to be parsed
public static double getDouble(String str,
boolean required)
str - string needed to be parsedrequired - if required, should be parsed successfully without default value to replace
Exception - if invalid format with required set 'true'
public static double getDouble(String str,
boolean required,
double defaultValue)
str - string needed to be parsedrequired - if required, should be parsed successfully without default value to replace; else use default value.defaultValue - default value
Exception - if invalid format with required set 'true'
|
||||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||