用双引号文本替换简单文本

问题描述:

String s =我是Abc;



我必须用Abc取代Abc



输出应该像我是Abc

但是我得到错误换行常数



我尝试了什么:



String s=" I am Abc";

I have to replace Abc with "Abc"

output should be like I am "Abc"
but I am getting error newline constant

What I have tried:

s = s.Replace("Abc", "\"Abc");

String s = " I am Abc";
     s = s.Replace("Abc", "\"Abc\"");





了解:



to understand:

string quotes = "\"";
       String s = " I am Abc";
       s = s.Replace("Abc", quotes +"Abc" +  quotes);