如何在双配额中添加字符串 [英] how to add string in double quota

查看:62
本文介绍了如何在双配额中添加字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将此字符串添加到"(双倍配额)...

例如< img src ="资源/图像/stumb.png"/>"

how to add this string into the "" (double quota)...

eg like "<img src=''resources/images/stumb.png'' />"

for (int i = 0; i < objProp.Count; i++)
{
if (i == objProp.Count - 1)
{
Image = Image + "<img src='Template/Resources /images/wmLarge_" + objProp[0].PropertyTitle.ToString() + "'/>";
}
else
{
Image = Image + "<img src='Template/Resources/images/wmLarge_" + objProp[0].PropertyTitle.ToString() + "'/>,";
}
}

推荐答案

使用转义序列"\"反冲来创建字符串"(双引号)

字符串图片=图片+"\""+"< img height ="60" width ="60" src ="Upload/saAdsImages/wmSmall_a.jpg"/>"+" \";
Use escape sequence ''\'' backlash to create string of ""(double quotes)

string Image = Image + "\"" + " <img height="60" width="60" src="Upload/saAdsImages/wmSmall_a.jpg" />" + "\"";


< img src =''resources/images/stumb.png''/>
两种方式:
1.对特殊字符如"''"使用转义序列"\"反冲.此处的详细信息: MSDN:转义序列 [
<img src=''resources/images/stumb.png'' />
Two ways:
1. Use escape sequence ''\'' backlash for special character like ''''''. Details here: MSDN: Escape Sequences[^]
string myImage = "<img src=\'resources/images/stumb.png\' />";



2.只需在字符串的开头放置"@":



2. Just put ''@'' at the beginning of the string:

string myImage = @"<img src='resources/images/stumb.png' />";


我使用转义序列"\"反冲来创建字符串"(双引号),
并使用"@"创建字符串\(例如:@"Server \ EXPRESS".
I use escape sequence ''\'' backlash to create string of ""(double quotes),
and use ''@'' to create string \ (eg: @"Server\EXPRESS".


这篇关于如何在双配额中添加字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆