c# - Replace string with another in DataColumn of DataTable -


i have datatable retrieves multiple columns , rows. 1 of column ("comments") contains data *. want replace character \n.

dtoutput = generix.gettickets(datetime.parse("1-1-1900"), datetime.now,"",iticket, "", "", "", "","",idispatched,ucode); string soutput = ""; foreach (datarow droutput in dtoutput.rows) {    soutput += ((soutput == "") ? "" : "~");    foreach (datacolumn dcoutput in dtoutput.columns)    {                                           soutput += ((soutput == "") ? "" : "|") + convert.tostring(droutput[dcoutput]);    } } 

i able merge columns in 1 string. how replace character in store in same string of "soutput".

in foreach loop can modify row accessing against column index ("comments") , use string.replace replace "*" "\n"

foreach (datarow droutput in dtoutput.rows) {      droutput["comments"] = droutput["comments"].tostring().replace('*','\n');      //your remaining code } 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -