在C#中替换字符串 [英] Replace string in C#
本文介绍了在C#中替换字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨所有
i在文本中有一个字符串,我想要替换它,但是在文本中看不到字符串,因为我认为我的语法错误。
我要替换的字符串是 Model:
替换它用 Model:]
当我尝试这条线时
string 正确= text.Replace( Model \:\>, Model \: [\);
它没有用,
任何帮助请
谢谢
解决方案
string 正确= text.Replace( Model \\ \\:\>, Model \:] \);
试试这个:
< span class =code-keyword> string 正确= text.Replace( Model \': \'>, 型号\':[\' );
hi all
i have a string in text and i want to replace it , but the string can''t be seen in the text as i think that i have a wrong syntax in it.
string i want to replace is Model":"
replace it with Model":]"
when i tried this line
string Correct = text.Replace("Model\":\">" , "Model\":[\"");
it didn''t work ,
any help please
thanks
解决方案
string Correct = text.Replace("Model\":\">", "Model\":]\"");
Try this:
string Correct = text.Replace("Model\':\'>" , "Model\':[\'");
这篇关于在C#中替换字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文