You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
441 B
24 lines
441 B
package kr.co.kihyun.lang; |
|
|
|
public class MInteger { |
|
|
|
public static int parseInt(String s) { |
|
return parseInt(s, 0); |
|
} |
|
|
|
public static int parseInt(String s, int earlyValue) { |
|
try { |
|
if (s != null) { |
|
return Integer.parseInt(s); |
|
} else { |
|
return earlyValue; |
|
} |
|
} catch (NumberFormatException ex) { |
|
return earlyValue; |
|
} |
|
} |
|
|
|
public static String toString(int num) { |
|
return (num > 9) ? ("" + num) : ("0" + num); |
|
} |
|
}
|
|
|