关于字符串分隔的问题。Split
class TestStringSplit
{
static void Main()
{
char[] delimiterChars = { ' ', ',', '.', ':', '\t' };
string text = "one\ttwo three:four,five six seven";
System.Console.WriteLine("Original text: '{0}'", text);
string[] words = text.Split(delimiterChars);
System.Console.WriteLine("{0} words in text:", words.Length);
foreach (string s in words)
{
System.Console.WriteLine(s);
}
}
}
分隔每个数组是 word[0] = 'one' word[1] = 'two' word[2] = 'three' ....
我想要结果是 word[0]= 'one' word[1] = '\t' word[2] = 'two' word[3] = 'three'...
如何实现。