- -这样拼接当然不行,用string.Format("",temp1,temp2,temp3,temp4);这样才是代码规范呢,直接string a+string b是不规范的,效率也相对低
很简单,用转义符\ 例如:我要把一个字符串The "book" I read is yours. 放到变量里面: var testString="The \"book\" I read is yours." 就行了当然var testString=‘The "book" I read is yours.’也行,你可以根据需要调整
代码段不用考虑 ' "如果是赋值var a='"';可以考虑把" 替换为\"