q; how to replace

  • Thread starter Thread starter Guest
  • Start date Start date
JIM.H. said:
How can I replace a ‘ (one quote) with a _ (underscore) in a string in c#?

Use the Replace method of the string class:

string aString = "A string 'with' apostrophes."
string newString = aString.Replace('\'', '_');
 
Back
Top