Commit bed37658 authored by yanzg's avatar yanzg

异常处理显示

parent 6ae0523e
...@@ -109,6 +109,47 @@ public class StringHelper { ...@@ -109,6 +109,47 @@ public class StringHelper {
return EMPTY; return EMPTY;
} }
/**
* 传入很多整形,获取第一个非0的值,至少需要两个参数
*
* @param from0 第一个参数
* @param froms 参数列表
* @return 第一个非0值
*/
public static Integer getFirst(Integer from0, Integer... froms) {
if (from0 != null && from0 != 0) {
return from0;
}
if (froms != null) {
for (Integer from : froms) {
if (from != null && from != 0) {
return from;
}
}
}
return 0;
}
/**
* 传入很多整形,获取第一个非0的值,至少需要两个参数
*
* @param from0 第一个参数
* @param froms 参数列表
* @return 第一个非0值
*/
public static Double getFirst(Double from0, Double... froms) {
if (from0 != null && from0 != 0) {
return from0;
}
if (froms != null) {
for (Double from : froms) {
if (from != null && from != 0) {
return from;
}
}
}
return 0.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