【发布时间】:2015-04-04 00:28:31
【问题描述】:
我目前正在寻求的结果是将textBox1.Text拆分为尽可能多的文本框,只要存在拆分符号(例如'+'或'#')
所以每个新文本框应该只有两个符号之间的单词 示例:
textBox1.text = "一+二+三";然后 textBox2.text = "one"; textBox3.text = "二"; textBox3.text = "三";
以下两个示例实现了我需要的 90%,但我仍然不知道如何将每个值放在单独的 textBox.text 中:
string str = "one\n \ntwo\n \nthree\n \n \nfour";
string[] result = Regex.Split(str, "\n\\s*");
for (int i = 0; i < result.Length; i++)
MessageBox.Show(result[i]);
和
string input = "one)(two)(three)(four)(five";
string[] result = input.Split(new string[] { ")(" }, StringSplitOptions.None);
foreach (string s in result)
MessageBox.Show(s);
【问题讨论】:
-
这是 Windows 应用程序(WPF 或 WinForms)还是 Web 应用程序(MVC 或 WebForms)?
-
@epotter 它是 Windows 应用程序(WinForms)
标签: c#