Hi all. I'm often having a need for removing whitespace in strings the following way:
1. Trim left and right
2. Replace all tabs (0x9) and linebreaks (0xA + 0xD) with spaces (0x20)
3. Turn all sequences of spaces to just one space
The third step is always a problem. The solutions I've been able to come up with are very cumbersome. But this must be a common problem, so I hope there's a general algoritm for this. Show me, please.