StringBuilder中的错误 [英] Error in StringBuilder
问题描述
我正在使用字符串生成器:
输出应该像这样:
以<<< 03/27/12>>为单位的INR中的NAVEQ NAV:<<股本基金-登记-股息>--<< 44.7340>> ;;<<<股本基金- Reg-Growth>-< 15.5980> ;;<股权基金-Inst-Growth>-< 12.4050> ;;
但是,当使用<<"时,结果不会显示出来;而是以这种方式出现:
<<><>
我还检查了它,再放置一个< before mode ="hold">
请帮忙.
感谢
Hi,
I am using a string builder:
The output shud be like this:
NAVEQ NAV in INR as on <<03/27/12>>: <<Equity Fund - Reg - Dividend>>-<<44.7340>>;<<Equity Fund - Reg - Growth>>-<<15.5980>>;<<Equity Fund - Inst - Growth>>-<<12.4050>>;
But while using "<<", the result doesnot get dispalyed; instead it comes in this way:
<><><>
I also checked it putting one more <before mode="hold">
Please help.
thanks
推荐答案
使用Server.HtmlEncode
Use Server.HtmlEncode
string MyURL=
"NAVEQ NAV in INR as on <<03/27/12>>: <<Equity Fund - Reg - Dividend>>-<<44.7340>>;<<Equity Fund - Reg - Growth>>-<<15.5980>>;<<Equity Fund - Inst - Growth>>-<<12.4050>>";
MyURL=Server.HtmlEncode(MyURL);
您可以使用以下代码绕过stringbuilder中的转义字符.
Hi,
you can use below code to bypass escape characters in stringbuilder.
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(@"<<>>");
因此,在您的情况下,您只需要在字符串前附加@(按速率)即可.
希望这些信息对您有帮助,
谢谢
-amit.
so in your case you just need to append @(at the rate) sing before your string.
hope this information will help you,
thanks
-amit.
这篇关于StringBuilder中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!