Returns the value of an option as an integer, or -1 if not defined.
(String option)
| 106 | * Returns the value of an option as an integer, or -1 if not defined. |
| 107 | */ |
| 108 | public static int |
| 109 | intValue(String option) { |
| 110 | String s = value(option); |
| 111 | if (s != null) { |
| 112 | try { |
| 113 | int val = Integer.parseInt(s); |
| 114 | if (val > 0) |
| 115 | return (val); |
| 116 | } |
| 117 | catch (NumberFormatException e) { |
| 118 | } |
| 119 | } |
| 120 | return (-1); |
| 121 | } |
| 122 | |
| 123 | } |
no test coverage detected