34,576
社区成员
发帖
与我相关
我的任务
分享
string str = ".00(2),7.00(1),8.00(4),";
str = Regex.Replace(str, @"(\d*?\.\d+)\((\d+)\)(?=[,,]|$)", delegate(Match m)
{
string source = "";
int n = Convert.ToInt32(m.Groups[2].Value);
for (int i = 0; i < n; i++)
source += m.Groups[1].Value + (i < n - 1 ? "," : "");
return source;
});