split("$")表示遇到$号分解元素么?
split( "$ ")表示遇到$号分解元素么?
------解决方案--------------------public string[] Split(params char[] separator)
参数
separator
分隔此实例中子字符串的 Unicode 字符数组、不包含分隔符的空数组或 空引用(在 Visual Basic 中为 Nothing)
用法(c#)
using System;
public class SplitTest {
public static void Main() {
string words = "this is a list of words, with: a bit of punctuation. ";
string [] split = words.Split(new Char [] { ' ', ', ', '. ', ': '});
foreach (string s in split) {
if (s.Trim() != " ")
Console.WriteLine(s);
}
}
}