string a=“1,2,3,ff”
给个函数 变成数组,分隔符 就是 , 
谢谢

解决方案 »

  1.   

    string[] b=a.split(new char[]{','});
      

  2.   


    string a = "1,2,3,ff";
    string[] ar = a.Split(',');
      

  3.   


       string s = "1,2,3,ff";
                string[] sList = s.Split(',');
                foreach (string item in sList)
                {
                    Console.WriteLine(item);
                }
      

  4.   

    string str.split(',')
    1、2、3楼都对啊
      

  5.   

    string[] aaa = a.Split(',');
      

  6.   

                string a = "1,2,3,ff";
                string[] ar = a.Split(',');
                
                foreach(string str in ar)
                {
                    try
                    {
                        MessageBox.Show(Convert.ToInt32(str).ToString()+" 是数字" );
                        //能转换 说明是数字, 可以装到你想要的数组中
                    }
                    catch
                    {
                        MessageBox.Show(str+" 不是数字!");
                    }
                }
      

  7.   

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Collections;
    namespace CSDN
    {
        class Program
        {
            static void Main(string[] args)
            {
                string a="1,2,3,ff";
                string[] b = a.Split(',');
                foreach (string item in b)
                {
                    Console.WriteLine(item );
                }
            }
        }
    }楼上都对