其實我是想用for回圈將一個字串陣列的所有中文括號中的字符提取出來存到另一個陣列,當然,最重要的是標題的問題,有請大佬表演
uj5u.com熱心網友回復:
要用正則平衡對uj5u.com熱心網友回復:
([^()]+)uj5u.com熱心網友回復:
string ch="fdsfdsa(fds)dsfds";
MatchesSection(ch,false);
public static List<string> MatchesSection(string ch,bool isInclude)
{
string strRegex = isInclude? @"(\([^\)]*\))": @"(?<=\()[^\)]+";//
MatchCollection Matches = Regex.Matches(ch, strRegex, RegexOptions.IgnoreCase);
List<string> str = new List<string>();
foreach (Match NextMatch in Matches)
{
str.Add(NextMatch.Value);
}
return str;
}
https://blog.csdn.net/u013010499/article/details/103250879
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/93458.html
標籤:C#
上一篇:C#影像互動與多執行緒
下一篇:C#
