string x = "I am a hunter, what do i do. <Name> is a good boy. His age is <Age> and a <occupation> of <Institute>. \n\n He is passionate about his <passion> and also a hardworking fellow. <WifeName> is his wife and she is a sweet girl, She loves her husband a lot. Her age is <WifeAge> and <occupation> of <Institute>";
这段文字没有任何意义。但我要做的是将所有“ <
”替换为“ <b>
”,将所有“”替换>
为“ </b>
”,将所有“ \n\n
”替换为“ <br/>
”。
我尝试使用:
string y = replace(replace(x,"<","<b>"),">","</b>");
这导致了我毁灭性的结果。我想你们都可以猜到,发生了什么。现在我正在寻找一种简单易行的替代解决方案。我希望,我能说清楚。