Skip to content

Instantly share code, notes, and snippets.

@JosephineAkello
Last active January 15, 2020 15:37
Show Gist options
  • Save JosephineAkello/8480ff0699bb4b2eb1b46819571d17d6 to your computer and use it in GitHub Desktop.
Save JosephineAkello/8480ff0699bb4b2eb1b46819571d17d6 to your computer and use it in GitHub Desktop.
Checking for a valid string and floating point using a regex
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