Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add thousand separator in android EditText .........?

I want to separate automatically edit text like (9,99,999) like this. i searched for this on web but i am not getting proper solution for this. can you please help me.thank you stack overflow.

like image 567
chandu Avatar asked Dec 01 '25 07:12

chandu


1 Answers

You can use DecimalFormat for this like below Code:

public String formatNumber(double d) {

        DecimalFormat formatter = (DecimalFormat) NumberFormat.getInstance(Locale.US);

        formatter.applyPattern("#,###");

        return formatter.format(d);
    }

You Can Pass Pattern as you want.

like image 200
Chetan Joshi Avatar answered Dec 02 '25 21:12

Chetan Joshi