Ask Your Question
2

Is it possible to type a decimal separator using both KeyboardType.Number and KeyboardType.Decimal in TextField?

asked 2021-07-24 11:00:00 +0000

plato gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-05-19 20:00:00 +0000

pufferfish gravatar image

Yes, it is possible to type in a decimal separator using both KeyboardType.Number and KeyboardType.Decimal in TextField.

When using KeyboardType.Decimal, the keyboard will show a decimal separator button. However, when using KeyboardType.Number, you can still type in a decimal separator by pressing the period (.) or comma (,) key depending on your device's regional settings.

For example, on a US keyboard, you would type a decimal separator using the period key. On a European keyboard, you would use the comma key.

You can also customize the decimal separator by setting the localization of the app to match the user's regional settings using the following code:

Locale.current.decimalSeparator

This will return the decimal separator character for the user's current locale.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2021-07-24 11:00:00 +0000

Seen: 12 times

Last updated: May 19 '21