我想在c#string中添加双引号。
string searchString = "123";
string inputString = "No matches found for "+ "\""+searchString + "\"";
OutPut:No matches found for "123"
答案 0 :(得分:4)
我认为您需要string.format
。
例如:
string.format("No matches found for \"{0}\"", searchString);
答案 1 :(得分:1)
你所拥有的应该产生你期望的东西:
No matches found for "123"
您也可以尝试:
string searchString = "123";
string inputString = String.Format(@"No matches found for ""{0}""!", searchString);
答案 2 :(得分:-4)
string inputString = String.Format(@"No matches found for \"{0}\"", searchString);