c# - Append string in another string -
this question has answer here:
i have string a="<tr>i'm working in c#<tr/> abcdefghjiklmnopqr ii oo yy uu hh gg rr"
, , b="<td>finish</td></tr>"
. need string a
a="<tr>i'm working in c#<tr/> <td>finish</td></tr> abcdefghjiklmnopqr ii oo yy uu hh gg rr".
how append string in string above? asked same question earlier wrong. here have find first ">" character , append b in a.
i suppose indexof , substrings
var a="<tr>i'm working in c#<tr/>abcdefghjiklmnopqr ii oo yy uu hh gg rr"; var b="<td>finish</td></tr>"; var insertpoint = a.indexof("<tr/>")+5; var c = a.substring(0,insertpoint) + b + a.substring(insertpoint);
but if you're trying html generation string concatenation, nightmare. try using razor, or other templating language.
Comments
Post a Comment