用string 的spilt函数

string str="1,0,1,1,10.000000,10.000000,0,0,0";
string[]strName = new string[20];
strName = str.spilt(",");

解决方案 »

  1.   

    楼上的笔误了,应该是split。
    其实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);
                  }
        }
        }
    }
      

  2.   

    换行处理函数应该参考一下fso对象,他有一个textstream对象可以进行readline方法操作,这样就读出了一整行。分割用split函数
      string tx = TextStream.ReadLine();
      string wrd = tx.Split(",",tx);
    上面的是个思路,你当然自己要把对象实例化
      

  3.   

    不好意思,有急事,太匆忙了,呵呵
    string wrd[] = tx.Split(",");
      

  4.   

    http://www.devarticles.com/c/a/ASP.NET/Reading_a_Delimited_File_Using_ASP.Net_and_VB.Net/2/
      

  5.   

    data.Replace("\r","")
    string[] abc = data.split(",");
    for ( int i=0;i < abc.Lenght;i++)
    {
       MessageBox.Show(abc[i]);
    }
      

  6.   

    各位直接用Spilt(",")的有没有自己试过,Split要的参数是个char的array,不是string。应该用:yourString.Split(",".ToCharArray());
      

  7.   

    string[] arrString =yourString.split(new char[]{'<你的分隔符>'});
      

  8.   

    1、string tt = WriteLine()读入一行文本
    2、char[] dd = new char[]{","}分隔符
    3、string[] aa =tt.split(dd)
      

  9.   

    you can try these codeStringReader reader = new StringReader(text);
    string s = reader.ReadLine();
    string[] ss = s.Split(new char[]{','});
    for(int i = 0; i < ss.Length; i++)
    {
       Console.Write(ss[i]);
    }
      

  10.   

    不好意思,写错了。
    应该是:
    string str="1,0,1,1,10.000000,10.000000,0,0,0";
    string[]strName = new string[20];
    strName = str.split(',');
      

  11.   

    好象读MapInfo的文件似的,做GIS啊?!
      

  12.   

    解决问题  给分楼上大哥:确实是在作GIS,但是是mapgis的明码文件 哈哈  果然是高手阿