问题:
How can brackets be escaped in using string.Format
. 如何使用string.Format
逃脱括号。 For example: 例如:
String val = "1,2,3"
String.Format(" foo {{0}}", val);
This example doesn't throw an exception, but outputs the string foo {0}
本示例不会引发异常,但会输出字符串foo {0}
Is there a way to escape the brackets? 有没有办法逃脱括号?
解决方案:
参考一: https://stackoom.com/question/Nla/如何在-NET中以格式字符串转义大括号-大括号参考二: https://oldbug.net/q/Nla/How-to-escape-braces-curly-brackets-in-a-format-string-in-NET
来源:oschina
链接:https://my.oschina.net/u/3797416/blog/4317134