我正在寻找 php sprintf 函数的 C# 等效项。
我有以下字符串:
"There are %s hits, %s are an exact match."
我想%s
替换为查询返回的数字。在 php 中,我将执行以下操作:
$res = sprintf("There are %s hits, %s are an exact match", $number1, $number2);
我如何在 C# 中做到这一点?我想过,string.replace()
但这只适用于应该更换的 1 件。在这种情况下,有多个。