using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
public static string[] MyStringSplit(string input, char[] separator)
{
string[] output = null;
if (input != null && separator != null)
{
int num = 1;
for (int i = 0; i < input.Length; i++)
{
for (int j = 0; j < separator.Length; j++)
{
if (input[i] == separator[j])
{
num++;
break;
}
}
}
output = new string[num];
int index = 0;
bool isSeparator = false;
for (int i = 0; i < input.Length; i++)
{
for (int j = 0; j < separator.Length; j++)
{
if (input[i] == separator[j])
{
index++;
isSeparator = true;
break;
}
else
isSeparator = false;
}
if (!isSeparator)
output[index] += input[i].ToString();
}
}
return output;
}
static void Main(string[] args)
{
//string test = null;
//string test = string.Empty;
string test = ".as f.,ad_sf..";
char[] separators = new char[] { '.', ',', '_', ' ' };
string[] a;
a = test.Split(separators);
Console.WriteLine(a.Length);
foreach (string item in a)
{
Console.WriteLine(item);
}
Console.WriteLine("-------------------------------");
a = MyStringSplit(test, separators);
Console.WriteLine(a.Length);
foreach (string item in a)
{
Console.WriteLine(item);
}
}
}
}