Returns true if all characters are numbers; first character is allowed to be + or - as well. Does not accept floating point, exponential notation, etc.
(String s)
| 351 | * Does not accept floating point, exponential notation, etc. |
| 352 | */ |
| 353 | public static boolean isSignedLong(String s) { |
| 354 | if (isEmpty(s)) return defaultEmptyOK; |
| 355 | |
| 356 | try { |
| 357 | Long.parseLong(s); |
| 358 | |
| 359 | return true; |
| 360 | } catch (Exception e) { |
| 361 | return false; |
| 362 | } |
| 363 | } |
| 364 | |
| 365 | /** Returns true if string s is an integer > 0. NOTE: using the Java Long object for greatest precision */ |
| 366 | public static boolean isPositiveInteger(String s) { |