我在這裏做錯了什麼?我希望用戶名稱在輸出中顯示爲propercase,但我無法弄清楚。正確的案例標題案例問題
string proper = this.xTripNameTextBox.Text;
CultureInfo properCase = System.Threading.Thread.CurrentThread.CurrentCulture;
TextInfo currentInfo = properCase.TextInfo;
proper = currentInfo.ToTitleCase(proper);
this.xTripOutputLabel.Text = proper + Environment.NewLine + "The total gallons you would use: " + Output.ToString("0") + Environment.NewLine + "Total amount it will cost you: " + Coutput.ToString("C") + Environment.NewLine +" Your customer number is " + rnd1.Next(1, 1000).ToString();
你能告訴我們你得到了什麼和你的期望嗎? – 2010-05-16 15:20:23
當用戶輸入「JOHN DOE」時,我得到了「JOHN DOE」它應該將其轉換爲「John Doe」,但我不知道什麼即時做錯了 – 2010-05-16 15:23:24
這就是問題所在,先用ToLower先將字符串小寫,然後標題框將工作。 – 2010-05-16 15:27:27