如何在.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
相關文章
相關標籤/搜索