Commit bd366987 authored by yanzg's avatar yanzg

Merge remote-tracking branch 'origin/master'

parents 16fc2d00 b23101e3
......@@ -110,6 +110,47 @@ public class StringHelper {
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