Commit fa7bc6d3 authored by yanzg's avatar yanzg

压缩视频

parent 5d9a6411
......@@ -455,10 +455,11 @@ public class StringHelper {
* 将字符串转换为 Int,当不能转换时,则默认为0
*
* @param from 需要转换的字符串
* @param def 转换不成功的默认值
* @return 转换成功后的值
*/
public static int toInt(Object from) {
int result = 0;
public static int toInt(Object from, int def) {
int result = def;
try {
if (!isEmpty(from)) {
// String类型的小数转int会出错
......@@ -477,6 +478,16 @@ public class StringHelper {
return result;
}
/**
* 将字符串转换为 Int,当不能转换时,则默认为0
*
* @param from 需要转换的字符串
* @return 转换成功后的值
*/
public static int toInt(Object from) {
return toInt(from, 0);
}
/**
* 将字符串转换为 long,当不能转换时,则默认为0
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment