.net - Replacing the appendLine in string builder in c# -


i have stringbuilder builds string. after processed, saves sql server table used csv. how replace part of string including newline?

the code is:

stringbuilder temp = new stringbuilder();  temp.appendline("\"text 1 \""); temp.appendline(""); temp.appendline("\"my text \""); temp.appendline(""); temp.appendline("\"text 2 \""); temp.appendline(""); 

i want replace middle part can't correct because of newlines/carriage returns.

temp = temp.replace("\"my text \"   "); 

how grab newlines?

if want replace new line charcater, use '\n' (a special charcater) :

  • temp = temp.replace("\n","your_replacing_string");

or use environment.newline:

  • temp = temp.replace(environment.newline,"your_replacing_string");

if want not append new line character in string builder :

  • instead of appendline(), use append() not insert new line character.

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -