【发布时间】:2017-07-17 17:10:48
【问题描述】:
我想在c#中将双连接替换为单连接
我试过了
sConfigration.Replace('"',''')
加上其他几种方式。
有什么想法吗?
【问题讨论】:
-
你在
sConfigration中的价值是多少 -
有什么问题
我想在c#中将双连接替换为单连接
我试过了
sConfigration.Replace('"',''')
加上其他几种方式。
有什么想法吗?
【问题讨论】:
sConfigration中的价值是多少
你需要将Replace的结果赋给原变量:
sConfigration = sConfigration.Replace("\"","'");
【讨论】:
.Replace('"','''); 语法不正确
string 是不可变的。 sConfigration.Replace('"',''') 返回 一个新字符串,并带有所需的替换。如果你不将它分配给任何东西,它就好像它甚至没有调用该方法一样。
执行以下操作:
sConfigration = sConfigration.Replace('"',''');
并且请修正拼写。
【讨论】: