C#字符串中的双引号

时间:2010-08-31 12:01:34

标签: c# string

我想在c#string中添加双引号。

string searchString = "123";
string inputString = "No matches found for "+ "\""+searchString + "\"";

OutPut:No matches found for "123"

3 个答案:

答案 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);