user962206
user962206

Reputation: 16117

Parsing a String to 2 Decimal Places to Double

Here's my String

37900

That I receive through an API.

However the real value of that item in double is 379.00

Also there might items that can be in the same format as that. so let's say

120000, the real value of this one is 1200.00

How do I parse it like that?

Upvotes: 0

Views: 100

Answers (1)

LearningProcess
LearningProcess

Reputation: 613

String numberAsString = "15,000";
double number = Double.parseDouble(numberAsString);
number = number/100;

Here is the String to double. Then dividing it to the format you want.

Upvotes: 1

Related Questions