1个回答
展开全部
private void button1_Click(object sender, EventArgs e)
{
string str = textbox1.Text.SubString(0, textbox1.Text.IndexOf("."));//截取以.结束的句子
String[] s = str.Text.Split(' ');//以空格划分单词
for (int i = 0; i < s.Length; i++)
{
s[i] = s[i].Substring(0, 1).ToUpper() + s[i].Substring(1).ToLower();//首字母大写
}
String outS = "";
for (int i = 0; i < s.Length; i++)
{
outS += s[i] + " ";
}
outS = outS.Substring(0, outS.Length - 1);
label1.Text = outS;
}
{
string str = textbox1.Text.SubString(0, textbox1.Text.IndexOf("."));//截取以.结束的句子
String[] s = str.Text.Split(' ');//以空格划分单词
for (int i = 0; i < s.Length; i++)
{
s[i] = s[i].Substring(0, 1).ToUpper() + s[i].Substring(1).ToLower();//首字母大写
}
String outS = "";
for (int i = 0; i < s.Length; i++)
{
outS += s[i] + " ";
}
outS = outS.Substring(0, outS.Length - 1);
label1.Text = outS;
}
追问
有没有按“.”号就结束 输入的。相当于 . 号充当回车的功能!
追答
可以实现,但不觉得那样很麻烦吗,直接按回车呗
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询