字符串问题
有个字符串“string 12 12 12”
如何获得"string" "12" "12" "12"四个子串
2011-05-09 23:18
程序代码:public string[] Split(
char[] separator,
StringSplitOptions options
)
// 参数
// separator
// 类型:array<System..::.Char>[]()[]
// 分隔此字符串中子字符串的 Unicode 字符数组、不包含分隔符的空数组或 nullNothingnullptrnull 引用(在 Visual Basic 中为 Nothing)。
// options
// 类型:System..::.StringSplitOptions
// 指定 RemoveEmptyEntries 以省略返回的数组中的空数组元素,或指定 None 以包含返回的数组中的空数组元素。
// 返回值
// 类型:array<System..::.String>[]()[]
// 一个数组,其元素包含此字符串中的子字符串,这些子字符串由 separator 中的一个或多个字符分隔。
2011-05-10 09:33
char[] sp={' '};
string s="string 12 12 12";
string[] str=s.Split(sp); //str[0]="string",str[1]=str[2]=str[3]="12".学学split的用法吧

2011-05-10 10:22
2011-05-11 12:20


2011-05-11 12:44

2011-05-11 16:27

2011-05-11 20:20