using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace StringBuilderTest
{
class Program
{
static void Main(string[] args)
{
string s1 = "one,two,three library,INC.";
const char Space = ' ';
const char Comma = ',';
char[] delimiters = new char[]
{
Space,
Comma
};
StringBuilder output = new StringBuilder();
int ctr = 1;
foreach (string subString in s1.Split(delimiters))
{
output.AppendFormat("{0}: {1} \n",ctr++,subString);
}
Console.WriteLine(output);
Console.ReadLine();
}
}
}
转载于:https://www.cnblogs.com/MarchThree/p/3720471.html