Jetpack Compose Currency Format on TextField element

Viewed 614

I'm trying to give some format to a TextField element for currency. I don't want to accept $ or € symbols at the beginning. I just want to accept the following range of values.

MIN VALUE: X
MAX VALUE: XXX.XX

I want to accept a . for split the integers from decimal.

For example minimum an integer and maximum three integer ( 0 — 999)

And for decimal part accept none of maximum two digits ( 0.99 — 0.1 — 1)

For the validations, I just want to have a leading zero just if it comes with decimal numbers, but if I put an integer the leading zero should be deleted. For example:

Can't accept these values:

00.2
0123.30

How can I do this with Jetpack Compose on Android?

0 Answers
Related