c# - put a <br /> tag after some text -
i have variable str having text. show text on ui. have condition, suppose variable having 5oo words, need put
tag after every 50 words.
how can that?
below c# code through sending mail html
emailbody += " <tr>"; emailbody += " <td align='left' valign='top' nowrap><span class=style17>purpose of travel</span></td>"; emailbody += "<td align='center' valign='top'>:</td>"; emailbody += " <td align='left' valign='top'><span class=style17> " + textbox1.text + "</span></td>"; emailbody += " <td> </td>"; emailbody += " <td align='left' nowrap'><span class=style17>advance</span></td>"; emailbody += " <td align='center'>:</td>"; emailbody += "<td align='left' nowrap><span class=style17>"+textbox2.text+"</td>"; emailbody += " </tr>";
i need the solution mt textbox1.text
if using c#, can :
public string splitline(string input) { var wordlist = input.split(' '); var sb = new stringbuilder(); (int index = 0; index < wordlist.length; index++) { if(index % 50 == 0 && index > 0) sb.append("<br/>" + wordlist[index]); else sb.append(wordlist[index] + ' '); } return sb.tostring(); }
Comments
Post a Comment