Last active
January 15, 2020 15:37
-
-
Save JosephineAkello/8480ff0699bb4b2eb1b46819571d17d6 to your computer and use it in GitHub Desktop.
Checking for a valid string and floating point using a regex
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
public class MyUtilities{ | |
public boolean isDigit(String s) | |
{ | |
if(s.matches("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")){ | |
return true; | |
} | |
else { | |
return false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment