相关疑难解决方法(0)

如何替换C#中的特定单词?

请考虑以下示例.

string s = "The man is old. Them is not bad.";
Run Code Online (Sandbox Code Playgroud)

如果我使用

s = s.Replace("The", "@@");
Run Code Online (Sandbox Code Playgroud)

然后它返回"@@ man is old. @@m is not bad."
但我想要输出"@@ man is old. Them is not bad."

我怎样才能做到这一点?

c# regex string replace

6
推荐指数
2
解决办法
1万
查看次数

标签 统计

c# ×1

regex ×1

replace ×1

string ×1