c# - How can I add a blank line to my StringBuilder? -
it known "issue" doing this:
sb.appendline();
...will not add blank line, 1 expect (as discussed here, instance).
however, commonly believed work:
sb.appendline(environment.newline);
...but it's not working me. i've got code:
for (int = 0; < listoflistitems.count; i++) { sb.appendline(environment.newline); lc = listoflistitems[i]; sb.appendline(string.format(@"<p>request date {0}; payee name {1}; remit address or mail stop {2}; last 4 of ssn or itin {3}; 204 submitted or on file {4}; requester name {5}; dept or div name {6}; phone {7}; email {8}</p>", lc.li_requestdate, lc.li_payeename, lc.li_remitaddressormailstop, lc.li_last4ssndigitsoritin, lc.li_204submittedoronfile, lc.li_requestername, lc.li_deptdivname, lc.li_phone, lc.li_email)); }
all data being added stringbuilder, , form gets generated, there no spaces between list items - "sb.appendline(environment.newline)" appending nothing.
what must force line between individual list item outputs?
the stringbuilder.appendline add \r\n end of string. not need explicitly add statement stringbuilder.appendline(system.environment.newline). can cross check converting string returned stringbuilder array of chars, can see newlines.
in example, looks trying display output in html (looking @ p tag in string) , newline not visible in html. in order achieve this, may want add br string.
sb.appendline("<br/>");
a carriage return (\r\n) has no meaning within html tags.