更新时间:2022-12-28 12:42:49
使用 Regex.Replace
:
string value = "6";
string sentence = "What is 3 x {contents}";
var result = Regex.Replace(sentence, "{.*?}", value); // What is 3 X 6
MSDN 是个好地方开始理解正则表达式
MSDN is a good place to start for understanding regex