I'm using a Character.isDigit for an if statement in a method i'm creating.
What it's supposed to do is if the string supplied is not a valid number it should return 0.0 as the result.
When I compile it, I get an error saying "cannot find symbol - method isDigit(java.lang.String)". Here's my code:
public double convertDouble (String value)
{
for(int i = 0; i < value.length();i++) {
if(value = Character.isDigit(value)) {
value = 0.0;
}
}
return Double.parseDouble(value);
}
Am i using the Character.isDigit wrong? How do i use it to fulfill what i want to do?