How to convert String to Long?

3.76K viewsJava
0

how to convert string to long  java?

Manohar Changed status to publish July 16, 2021
Add a Comment
3

Use the 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;
}
}

 

Manohar Changed status to publish June 24, 2021
Add a Comment
Write your answer.