Created
July 15, 2016 23:26
-
-
Save JosiasSena/c257013bb222ad2430334468bd442ea1 to your computer and use it in GitHub Desktop.
Check if the string contains a number or a special character
This file contains hidden or 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
/** | |
* Check if the string contains a number or a special character | |
* | |
* @param text - string to check | |
* @return - true if it contains a number or a special character, else false | |
*/ | |
public boolean textContainsSpecialCharsOrNumbers(String text) { | |
return !text.matches("^[a-z A-Z]+$"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment