CurrencyEditText icon indicating copy to clipboard operation
CurrencyEditText copied to clipboard

Croatian locale doesn't use a comma, but on the bills of customers there is a comma

Open emailsubjekt opened this issue 6 years ago • 5 comments
trafficstars

There must be something wrong or what? I've tried
cetPayment.setLocale(new Locale("hr", "HR"));

What could be the problem? Or is it that you don't use decimals here? I'm getting 4.588.888.888 and instead should be getting 45.888.888,88

emailsubjekt avatar Jun 26 '19 01:06 emailsubjekt

Hello?

emailsubjekt avatar Jun 27 '19 00:06 emailsubjekt

Hellooooo?

emailsubjekt avatar Jun 29 '19 23:06 emailsubjekt

Hellooooooooo?

emailsubjekt avatar Jul 02 '19 03:07 emailsubjekt

I checked and getNumericValue function seems to have problems. You can get the value by getText instead.

yigitserin avatar Aug 23 '19 13:08 yigitserin

Hi yigitserin. I forked your project with a new implementation in kotlin and fixed some bugs including this. https://github.com/GMCristiano/CurrencyEditText

Kotlin solution for this:

    val numericValue: Double
        get() {
            return try {
                val format = NumberFormat.getInstance(locale)
                val parse = format.parse(text.toString())
                parse!!.toDouble()
            } catch (e: Exception) {
                Double.NaN
            }
        }

GMCristiano avatar Nov 13 '20 23:11 GMCristiano