0

Hey

I want to remove all strange whitespaces (such as Alt+0160) except the actual space, as in spacebar.

How can I do this?

Edited by riahc3

3
Contributors
2
Replies
27
Views
4 Years
Discussion Span
Last Post by Ketsuekiame
1

Determine if a char is whitespace and exclude a space. Look here for a start.
If you are familiar with Regex, you could use that as well.

Edited by ddanbe: addition

1

new String(stringVariable.Where(c => !char.IsWhiteSpace(c) || c.Equals(' ').ToArray());

Substitute stringVariable for the actual variable of your existing string. This will return you a string with all whitespace except for spacebar removed.

In ddanbe's defense, he replied with appropriately the right information given what you had posted. However, seeing your other post and that you're an active forum member, I decided to give a more direct answer.

Edited by Ketsuekiame

Votes + Comments
Ofcourse! LINQ!
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.