List<string> strList = new List<string>(); MatchCollection mc = Regex.Matches(cname, @"\w+"); if (mc.Count > 0) for (int i = 0; i < mc.Count; i++) { strList.Add(mc[i].Value.Remove(0,1)); } return strList;
List<string> strList = new List<string>(); MatchCollection mc = Regex.Matches(condition, @"[^\w@]@[\w#][\w@#]+"); if (mc.Count > 0) for (int i = 0; i < mc.Count; i++) { strList.Add(mc[i].Value); } return strList;
MatchCollection mc = Regex.Matches(cname, @"\w+");
if (mc.Count > 0)
for (int i = 0; i < mc.Count; i++)
{
strList.Add(mc[i].Value.Remove(0,1));
}
return strList;
MatchCollection mc = Regex.Matches(condition, @"[^\w@]@[\w#][\w@#]+");
if (mc.Count > 0)
for (int i = 0; i < mc.Count; i++)
{
strList.Add(mc[i].Value);
}
return strList;
str=cname.substring(cnmae.indexof("{")+1,cname.length-name.length-2).split('#');
ah=str[0];
bh=str[1];
ch=str[2];
dh=str[3];
for(int i=0;i<s.Length;i++)
{
string name=s[i].ToString();
}
string[] strResult = regex.Split("明细技术{5#6#78#12}");
明细技术{5#6#78#12}
那就好办了,我做过的是直接用split,定义一个String数组来存储分割后的字符串数组!(分隔符为#)
而后只要对第一个String做处理,去掉{ ,和对最后一个String 做处理去掉 },就可以了, (我想这样的处理你应该是会的了!)
yistudio(阳光灿烂的日子) 你可以用来参照,我写的没有他(她)这么精简,就不放代码了!!
a =sheetname.IndexOf("{");
b =sheetname.IndexOf("}");
rootkey=sheetname.Substring(a+1,b-a-1);
name=sheetname.Substring(0,a-1);
string delimStr = "~";
char [] delimiter = delimStr.ToCharArray();
strTemp = rootkey.Split(delimiter);
ah= strTemp[0].ToString();
bh =strTemp[1].ToString();
ch = strTemp[2].ToString();
dh = strTemp[3].ToString();