はパスカルケースでは、Word本出願は、書かれた文字列を取ることになっているセパレータアプリケーション
Hello how are you?
現在のところ、このコードは各単語が別の文字で表示されている場合にのみ機能します。例文HelloHowAreYou
は、hellohow are you?
となっています。どうしてですか?
private void btnSeparate_Click(object sender, EventArgs e)
{
// Get the sentence from the text box
string sentence = txtWords.Text;
int upperCase; // to hold the index of an uppercase letter
foreach (char up in sentence)
{
if (char.IsUpper(up))
{
// Find the index of the uppercase letter
upperCase = sentence.IndexOf(up);
// Insert a space at the appropriate index
sentence = sentence.Insert(upperCase, " ");
}
}
// Make all the letters lowercase
sentence = sentence.ToLower();
// Capitalize the first letter of the sentence.
sentence = sentence[1].ToString().ToUpper() + sentence.Substring(2);
// Display the separeted words
lblSeparatedWords.Text = sentence;
}
}
'IndexOf'(F9)にブレークポイントを入れて、あなたは文字によって、文字列の文字を反復処理として何が起こるかを参照してください。 – xxbbcc