【发布时间】:2010-07-09 12:22:56
【问题描述】:
C# 2005,我在 Program.cs 中设置了如下文化:
CultureInfo myCulture = new CultureInfo("bn-IN");// like "en-US", "ja-JP" etc...
Thread.CurrentThread.CurrentCulture = myCulture;
Thread.CurrentThread.CurrentUICulture = myCulture;
Application.CurrentCulture = myCulture;
然后在打开应用程序后,我选择我的键盘,然后点击键盘 1,我的语言版本为 1。现在我想将其转换为整数,以便我可以执行加法、减法等操作。所以...
CultureInfo myCulture = Application.CurrentCulture;
myCulture.NumberFormat.DigitSubstitution = DigitShapes.NativeNational;
int i = Convert.ToInt32(textbox1.Text, myCulture.NumberFormat);// this line throws exception with message "Input string was not in a current format"
那么如何将另一种文化(“en-US”除外)中的字符串转换为整数?
【问题讨论】:
标签: string keyboard integer cultureinfo