本文介绍了split功能有什么用?请给我一个例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
分割功能有什么用?请给我一个例子
what is the use of split function? Please give me an example
推荐答案
string input = "hello;there is a text line;goodbye";
string[] parts = input.Split(';');
将在parts数组中给您三个字符串:
would give you three strings in the parts array:
hello
there is a text line
goodbye
public static ArrayList split_FileNo (string ss)
{
string[] split = ss.Split(new Char[] { ' ',',','\r','\n'});
ArrayList al=new ArrayList();
foreach (string s in split)
{
if (s.Trim() != "")
al.Add(s);
}
return al;
}
输入:"Uma Shankar"
输出:
乌玛
香卡(Shankar)
Input: "Uma Shankar"
output:
Uma
Shankar
这篇关于split功能有什么用?请给我一个例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!