Skip to content

Instantly share code, notes, and snippets.

@TheJoshGriffith
Created May 10, 2015 21:56
Show Gist options
  • Save TheJoshGriffith/621d1c8ba99908fe965d to your computer and use it in GitHub Desktop.
Save TheJoshGriffith/621d1c8ba99908fe965d to your computer and use it in GitHub Desktop.
/**
* If the parameter passed to the method is numerical or can be converted to a numerical value,
* we return true, otherwise we return false
*/
public boolean canConvertToInteger(String value)
{
try
{
Integer.parseInt(value);
}
catch (Exception ex)
{
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment