How to convert String to Long?

1.98K viewsJava
0

how to convert string to long  java?

Changed status to publish
Add a Comment
3

Use below snippet :

public static Long convertStringToLong(String stringValue) {
try{
NumberFormat numberFormat = NumberFormat.getInstance();
Number number = numberFormat.parse(stringValue);
return number.longValue();
}catch(Exception e){
return null;
}
}

 

Changed status to publish
Add a Comment
Write your answer.