字符串:单据编号为:[单据头.单据编号],制单日期为:[单据头.业务日期],制单人是:[单据头.制单人],请审核.
希望得到如下的数组:
[[单据头.单据编号],[单据头.业务日期],[单据头.制单人]]
public static void RunSnippet()
{
string str = "单据编号为:[单据头.单据编号],制单日期为:[单据头.业务日期],制单人是:[单据头.制单人],请审核";
StringBuilder sb = new StringBuilder();
for(int i=0; i<str.Length; i++)
{
if(str[i] == '[')
{
sb.Append(str.Substring(i, str.IndexOf(']', i) - i + 1)).Append(',');
}
}
sb.ToString().Split(',');
}
http://topic.csdn.net/u/20110714/17/2daf64fa-7585-40b7-9a76-71bf10bb3e6f.html