简体   繁体   中英

Input decimal with commas in c#

i have a question

in Indonesia, we usually use 8,5 not 8.5 but when i write 8,5 in textbox it mean 85

how to solve it? simply i want to change the dot with commas

You are probably using double.TryParse somewhere. Switch to this overload and pass in an Indonesian culture for the provider parameter using new CultureInfo("id-ID") .

Example with double.Parse :

double result = double.Parse("6,5", new CultureInfo("id-ID"));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM