0

用浮点数中的点替换逗号的最佳方法是什么,而不会弄乱文化/语言环境文件 - 因为我的应用程序的某些部分取决于其当前设置。

是否有 .Replace() 方法或其他方法?

txtAirtime.Text = "R" + new_val; (new_val at this time is 1.61)

4

1 回答 1

1

The compiler is doing an automatic float-to-string conversion, using the current locale of the emulator / phone.

You will need to do an explicit float-to-string conversion that tells the compiler not to take into account the current locale.

txtAirtime.Text = "R" + new_val.ToString(System.Globalization.CultureInfo.InvariantCulture);

于 2013-07-11T13:26:11.357 回答