Answers for "how to get if a charcter is a float java"

1

test if string is float java

public static void main(String[] args) {
    String str = "5588";
    //check if int
    try{
        Integer.parseInt(str);
    }catch(NumberFormatException e){
        //not int
    }
    //check if float
    try{
        Float.parseFloat(str);
    }catch(NumberFormatException e){
        //not float
    }
}
Posted by: Guest on December-13-2020

Code answers related to "how to get if a charcter is a float java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language