static void Main(string[] args) { var content = "名称:{名称},发十多个地方的{透后小结}辅导书的"; var temp = content.Substring(content.IndexOf("{")); var listContent = temp.Substring(0, temp.LastIndexOf("}") + 1).Replace('{', ';').Replace('}', ';').Split(';').Where(x => !string.IsNullOrWhiteSpace(x)).ToList(); listContent.ForEach(x => { content = content.Replace("{" + x + "}", "1"); }); //名称:1,发十多个地方的1辅导书的 Console.ReadLine(); }
标签:string,temp,var,content,标识,字符串,Replace,辅导书,替换 From: https://www.cnblogs.com/cxxtreasure/p/16709314.html