本文介绍了如何在div中追加字符串(字符串格式)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下字符串格式。
I have following string formats with me.
string mainDiv = "<div> Dear Requestor, </div ><br/><div> Please see below details </div><br/> <div id = 'divlink' style = '{{divStyleCSSLink}}'> </div>";
mainDiv += "<div id = 'divappend' style = '{{divStyleCSS}}'>";
mainDiv += "</div>";
mainDiv += "<br/><br/><br><div><b> Thank You,<br> ABC </b></div>";
string divlink = "<a href='{{Link}}'><b>Link to data entry</b></a>";
string divtbl = "<br><div style='{{divStyleCSS}}'>Please provide the OA mapping in the below format</div><br><table border = '1px' cellpadding = '5' cellspacing = '0' style = '{{divStyleCSS}}' >";
divtbl += "< tr style = 'background-color:#0b60aa; font-weight:bold; {{divStyleCSS}}' >";
divtbl += "<td> Entity </td>";
divtbl += "<td> Item ID </td>";
divtbl += "<td> Item Date </td> ";
divtbl += "<td> Currency </td> ";
divtbl += "<td> Amount </td> ";
divtbl += "</tr> ";
divtbl += "<tr> ";
divtbl += "<td style = 'padding-right: 20px;{{divStyleCSS}}' > </td> ";
divtbl += "<td style = 'padding-right: 20px;{{divStyleCSS}}' > </td> ";
divtbl += "<td style = 'padding-right: 20px;{{divStyleCSS}}' > </td> ";
divtbl += "<td style = 'padding-right: 20px;{{divStyleCSS}}' > </td> ";
divtbl += " <td style = 'padding-right: 20px;{{divStyleCSS}}' > </td> ";
divtbl += "</tr> ";
divtbl +=" </table ><br/><br/> ";
我需要的是我需要在这里附加字符串divlink
div< div id ='divlink' style ='{{divStyleCSSLink}}'> < / div>
对于divtbl我需要追加到< div id ='divappend'style ='{{divStyleCSS}}'>< ; / div>;
我尝试过:
如何实现这一目标。我不想在
What i require is i need to append string divlink inside this
div <div id = 'divlink' style = '{{divStyleCSSLink}}'> </div>"
same for divtbl i need to append inside <div id = 'divappend' style = '{{divStyleCSS}}'> </div>";
What I have tried:
How to achieve this. i would not like to use placeholder {{Test}} inside
{{Test}}
推荐答案
string mainDiv = "<div> Dear Requestor, </div ><br/><div> Please see below details </div><br/>";
mainDiv+= "<div id = 'divlink' style = '{{divStyleCSSLink}}'> {0} </div>";
mainDiv += "<div id = 'divappend' style = '{{divStyleCSS}}'> {1}" ;
mainDiv += "</div>";
mainDiv += "<br/><br/><br><div> Thank You,<br> ABC </div>";
string final = string.Format(mainDiv, divlink, divtbl);
参考 []
这篇关于如何在div中追加字符串(字符串格式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!