Skip to content

Commit 0917584

Browse files
committed
[commit] change
1 parent 2ec53cd commit 0917584

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

library/src/main/java/com/code19/library/StringUtils.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,16 @@ public static String strFormat2(String str) {
209209
return str;
210210
}
211211

212+
public static int conver2Int(Object value, int defaultValue) {
213+
if (value == null || "".equals(value.toString().trim())) {
214+
return defaultValue;
215+
}
216+
try {
217+
return Double.valueOf(value.toString()).intValue();
218+
} catch (Exception e) {
219+
e.printStackTrace();
220+
return defaultValue;
221+
}
222+
}
223+
212224
}

0 commit comments

Comments
 (0)