how to replace any charachter with nothing. for example
1 : string inputString = "This Is Stack OverFlow";
2 : string outputString = inputString.Replace(' ', '');
expected output = "ThisIsStackOverFlow";
I tried line 2 but it says empty Character String in Replace methods second argument. Can any body tell me whats wrong with my Replace Method and why it does not take blank like we normally use in string (for ex : "")?
''
isn't a valid character. You actually want no character, so you can't use that notation and you need to use thestring
one. The closest option is a null character, but you don't want that.