Removal of Tab-whitespace?

.net, c#, replace, string, whitespace

Solution

Yes. remove tabs too:

string s = "This is a string without        spaces";
s = s.Replace(" ", string.Empty);
s = s.Replace("\t", string.Empty);

Problem

I've encountered a rather strange problem in C# around removal of whitespace. My current code looks like this: ``` string s = "This is a string without spaces"; s = s.Replace(" ", string.Empty); ``` In this example, the last spaces at the end, after "without" is a indent (Tab) and not actually Spacebar spaces. Apparently String.Replace doesn't care about that, so it ignores it, and leaves THAT whitespace there. Is it possible to avoid this issue?

Original source