任何人都可以帮我解决这个问题 [英] Can any one help me to solve this

查看:75
本文介绍了任何人都可以帮我解决这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望在文本框中得到这样的价值



如果我输入这样的文字......



hiii,你好; satya!,anusha`



i需要得到这样的输出



hiii

你好

satya

anusha

i want get value to be seperated like this in textbox

if i enter text like this ...

"hiii",hello;satya!,anusha`

i need to get output like this

hiii
hello
satya
anusha

推荐答案

你好,



尝试使用 Regex.Split

Hi,

Try to use Regex.Split:
string input = "\"hiii\",hello;satya!,anusha`";
string[] results = System.Text.RegularExpressions.Regex.Split(input, @"[^\w]").Where(s => !string.IsNullOrWhiteSpace(s)).ToArray();



更多关于 Regex.Split http://msdn.microsoft.com/en-us/library/8yttk7sy.aspx [ ^ ]

关于正则表达式的更多信息: http://msdn.microsoft.com/en-us/library/az24scfc.aspx [ ^ ]



希望这有帮助。


More about Regex.Split: http://msdn.microsoft.com/en-us/library/8yttk7sy.aspx[^]
More about regular expressions: http://msdn.microsoft.com/en-us/library/az24scfc.aspx[^]

Hope this helps.


这篇关于任何人都可以帮我解决这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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