blob: cc8faaa5b3287234f9bdf5727dce419c5ef740ca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package com.btr.proxy.util;
public class MiscUtil {
/**
* Parse int, return fallback value on exception
*
* @return integer
*/
public static int parseInt(String input, int radix, int fallback) {
try {
return Integer.parseInt(input, radix);
} catch (Exception e) {
return fallback;
}
}
public static int parseInt(String input, int radix) {
return parseInt(input, radix, -1);
}
public static int parseInt(String input) {
return parseInt(input, 10, -1);
}
}
|