分割逗号分隔的文字 [英] Splitting comma-separated text

查看:63
本文介绍了分割逗号分隔的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我有一个文本框和一个按钮
现在我想要单词之前的方式可能与昏迷之前的按钮单击有所不同

例如,文本框的值为代码,项目,块"

现在我单击按钮,然后显示文本框的值是任何控件中的此类型

代码
项目


请帮助我

在此先感谢

Hello all

i have one textbox and one button
now i want How are prior to the word may differ of Before Coma OF Button Click

E.g the textbox value are ''Code,Project,Block''

Now I Click button then show textbox value are this type In any control

Code
Project
Block

Please help Me

thanks in advance

推荐答案

如果我了解您,请尝试执行以下操作

If I understand you, then try something like this

string[] words = textBox.Text.Split('','');
foreach(string word in words)
{
   listBox.Items.Add(word);
}


您应该使用string.Split方法:

http://msdn.microsoft.com/en-us/library/b873y76a.aspx [ ^ ]
You should use the string.Split method:

http://msdn.microsoft.com/en-us/library/b873y76a.aspx[^]


这篇关于分割逗号分隔的文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆