更新时间:2023-02-26 12:17:34
从右至左的问题弄乱了结果,特别是"@"字符.将您的功能修改为:
It is the right-to-left issue that messes up the results, in specific, it is the "@" char. modify your function to:
public void Fancy_placeholder_should_be_replaced()
{
const string input = "(השדה @%1$ קצר מדי (@%2$ תווים לפחות";
const string expected = "(השדה {0} קצר מדי ({1} תווים לפחות";
var formatted = input.Replace("@%2$", "{1}");
formatted = formatted.Replace("@%1$", "{0}");
bool same2 = expected == formatted;
Assert.AreEqual(expected, formatted);
}
和田田!它有效...
And tada! it works...