Friday, January 25, 2013

Java: is String null or number

Perhabs this code is helpfully for you. I used it to check if the content of a GWT TextBox contains an integer number. It use regular expressions to check if the content of the String is an integer and not null.
protected boolean isNotNullAndNumber(String value) {
 return (value != null && value.matches("\\d+"));
}

No comments:

Post a Comment