用string 的spilt函数
如
string str="1,0,1,1,10.000000,10.000000,0,0,0";
string[]strName = new string[20];
strName = str.spilt(",");
如
string str="1,0,1,1,10.000000,10.000000,0,0,0";
string[]strName = new string[20];
strName = str.spilt(",");
其实msdn中的帮助就很好,如下:using System;public class StringSplit2 {
public static void Main() { string delimStr = " ,.:";
char [] delimiter = delimStr.ToCharArray();
string words = "one two,three:four.";
string [] split = null; Console.WriteLine("The delimiters are -{0}-", delimStr);
for (int x = 1; x <= 5; x++) {
split = words.Split(delimiter, x);
Console.WriteLine("\ncount = {0,2} ..............", x);
foreach (string s in split) {
Console.WriteLine("-{0}-", s);
}
}
}
}
string tx = TextStream.ReadLine();
string wrd = tx.Split(",",tx);
上面的是个思路,你当然自己要把对象实例化
string wrd[] = tx.Split(",");
string[] abc = data.split(",");
for ( int i=0;i < abc.Lenght;i++)
{
MessageBox.Show(abc[i]);
}
2、char[] dd = new char[]{","}分隔符
3、string[] aa =tt.split(dd)
string s = reader.ReadLine();
string[] ss = s.Split(new char[]{','});
for(int i = 0; i < ss.Length; i++)
{
Console.Write(ss[i]);
}
应该是:
string str="1,0,1,1,10.000000,10.000000,0,0,0";
string[]strName = new string[20];
strName = str.split(',');