- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Data;
-
- namespace Study
- {
- public static class Program3
- {
- static void Main(string[] args)
- {
- Proccess(@"13212345671,13312345672, 13412345674
- 13212345674,");
- Proccess("");
- Proccess(null);
- Console.Read();
- }
-
- public static void Proccess(string str)
- {
-
-
-
- string[] arr = (str ?? string.Empty).Split(new char[] { ‘,‘, ‘\t‘, ‘\n‘, ‘ ‘ }, StringSplitOptions.RemoveEmptyEntries);
- Console.WriteLine("本次切分后数组的长度为:{0}", arr.Length);
- int i = 1;
- foreach (string s in arr)
- {
- Console.WriteLine("{0}:{1}", (i++).ToString(), s);
- }
- }
- }
- }

C# 如何用多个字符串来切分字符串并去除空格
原文:http://www.cnblogs.com/just09161018/p/4605333.html