Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #test #string #float #java
ADD COMMENT
Topic
Name
1+4 =