Reputation: 49
I have some numbers like 100,000 and I want to output as 1 Lakh in Indian numbering system. is there any method that supports it?
Detailed Example:
Input 5,50,000
Output 5.5 Lakh
Upvotes: 0
Views: 658
Reputation: 521279
You could try stripping the commas, casting to an integer, the dividing to get the number of Lakhs:
DecimalFormat df = new DecimalFormat("#.#####");
String input = "5,50,000";
double lakhs = Double.parseDouble(input.replaceAll(",", "")) / 100000;
String out = df.format(lakhs);
System.out.println(out);
Upvotes: 1