string txt = "妈妈女医生,爸爸男医生,姐姐女医生,哥哥男医生";
Response.Write("<br />" + txt);
//按单字符分
char c = ',';
string[] splitByChar = txt.Split(c);
Response.Write("<br /><br />按单字符分:");
foreach (string s in splitByChar)
{
Response.Write("<br />" + s);
}
//按医生两个字符分
string chars = "妈爸姐哥";
string[] splitByChars = txt.Split(chars.ToArray());
Response.Write("<br /><br />按多字符分:");
foreach (string s in splitByChars)
{
Response.Write("<br />" + s);
}
//按字符串分
string splitTxt = "医生";
Response.Write("<br /><br />按字符串分:");
string[] splitByString = System.Text.RegularExpressions.Regex.Split(txt, splitTxt);
foreach (string s in splitByString)
{
Response.Write("<br />" + s);
}