我有一个像"Research Expenses: Itemize and follow <a href=" http://www.borenawards.org/boren_fellowship/budget.html" target="_blank">budget guidelines</a>(maximum $3,000)"
我想将该值分配给sting变量。
string value= Research Expenses: Itemize and follow <a href=" http://www.borenawards.org/boren_fellowship/budget.html"
target="_blank">budget guidelines</a>(maximum $3,000);
我需要的是,无论传递给它的是什么字符串,我都必须在双引号中显示内容。如何添加双引号?
我想显示"Research Expenses: Itemize and follow <a href=" http://www.borenawards.org/boren_fellowship/budget.html" target="_blank">budget guidelines</a>(maximum $3,000)"
之类的字符串。请帮助我
答案 0 :(得分:1)
你好,你可以使用转义序列,如:
string value= "Research Expenses: Itemize and follow <a href=" http://www.borenawards.org/boren_fellowship/budget.html"
target="_blank">budget guidelines</a>(maximum $3,000)";
你可以通过删除双引号并用单引号替换它们来使用另一种替代方法,最后它们可以正常工作:例如:
string value= "Research Expenses: Itemize and follow <a href=' http://www.borenawards.org/boren_fellowship/budget.html'
target='_blank'>budget guidelines</a>(maximum $3,000)";
你有两种选择,选择权归你所有。
祝你好运。
答案 1 :(得分:0)
如果希望它们包含在变量值中,您可以转义双引号,如下所示:
string str = "Research Expenses: Itemize and follow <a href=\" http://www.borenawards.org/boren_fellowship/budget.html\" target=\"_blank\">budget guidelines</a>(maximum $3,000)";
答案 2 :(得分:0)
在你的字符串中替换&#34;用\&#34;
答案 3 :(得分:0)
2种可能性:
"Research Expenses: Itemize and follow <a href=\"http://www.borenawards.org/boren_fellowship/budget.html\" target=\"_blank\">budget guidelines</a>(maximum $3,000)"
"Research Expenses: Itemize and follow <a href='http://www.borenawards.org/boren_fellowship/budget.html' target='_blank'>budget guidelines</a>(maximum $3,000)"
答案 4 :(得分:0)
string value = @&#34; Research Expenses:Itemize并关注http://www.borenawards.org/boren_fellowship/budget.html"&#34; target =&#34;&#34; _blank&#34;&#34;&gt;预算指南(最高$ 3,000)&#34 ;;