|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20所有这些字符串,把它的数字一个个剥离??

using System;

public class Demo
{
    static void Main()
    {
        string str = "|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20";

        string delimStr = "|";
        string[] split = str.Split(delimStr.ToCharArray());

        int [] a = new int[split.Length - 1];
        for(int i = 0; i < split.Length - 1; i++)
        {
            a[i] = int.Parse(split[i + 1]);
        }

        foreach (int temp in a)
        {
            Console.WriteLine(temp);
        }
    }
}

原文地址:https://www.cnblogs.com/Fooo/p/741664.html