Created
May 18, 2017 13:32
-
-
Save fty4/ff3319a560512a509489e6a709df3d29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Gibt an ob ein String ein Integer-Wert (Ganzzahl) darstellt | |
* | |
* @param p_str | |
* Zu pruefender String | |
* @return boolean-Wert | |
*/ | |
private static boolean isInteger(String p_str) { | |
if (p_str == null) | |
return false; | |
else | |
return p_str.matches("^\\d*$"); | |
} | |
// ODER | |
public static boolean isInteger(String input) { | |
try { | |
Integer.parseInt(input); | |
return true; | |
} catch (Exception e) { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment