How to convert String to Long?

2.74K 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
You are viewing 1 out of 1 answers, click here to view all answers.
Write your answer.