How To Find A String And Replace It With Another String Using C#



TODO:

Have you ever wanted to replace a string that exists in another string?

 

SOLUTION:

string foo = "123456-7890-abcd";
string bar = foo.Replace("-", "");

 

NOTES:

The example above will replace '-' with an empty string.  The result will be 1234567890abcd.