split功能有什么用?请给我一个例子 [英] what is the use of split function? Please give me an example
本文介绍了split功能有什么用?请给我一个例子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
分割功能有什么用?请给我一个例子
what is the use of split function? Please give me an example
推荐答案
基于字符串定界字符将字符串分成子字符串:
To break a string into sub-strings, based on a string delimiting character:
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
阅读以下内容:
http://www.dotnetperls.com/string-split [ http://msdn.microsoft.com/zh-我们/library/system.string.split%28v=VS.85%29.aspx [ http://msdn.microsoft.com/en-us/library/b873y76a%28v = VS.85%29.aspx [ ^ ]
http://msdn.microsoft.com/en-us/library/ms228388%28v = VS.90%29.aspx [ ^ ]
Read the following:
http://www.dotnetperls.com/string-split[^]
http://msdn.microsoft.com/en-us/library/system.string.split%28v=VS.85%29.aspx[^]
http://msdn.microsoft.com/en-us/library/b873y76a%28v=VS.85%29.aspx[^]
http://msdn.microsoft.com/en-us/library/ms228388%28v=VS.90%29.aspx[^]
Split()用于将字符串分成多个字符串
Split() is used to break string into multiple strings
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功能有什么用?请给我一个例子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文