如何在.NET中以格式字符串转义大括号(大括号) - How to escape braces (curly brackets) in a format string in .NET

问题:

How can brackets be escaped in using string.Format . 如何使用string.Format逃脱括号。 For example: 例如: curl

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} url

Is there a way to escape the brackets? 有没有办法逃脱括号? spa


解决方案:

参考一: https://stackoom.com/question/Nla/如何在-NET中以格式字符串转义大括号-大括号
参考二: https://oldbug.net/q/Nla/How-to-escape-braces-curly-brackets-in-a-format-string-in-NET
相关文章
相关标签/搜索