It's not big, but it's useful.
I spent a lot of time looking for this, but I couldn't find anything that specifically handled this issue, so I made it myself.
Suppose you want to make a chat function
verb
Chat(T as text)
if(length(T) == 0) return
else
view(src) << "[src] says: [T]"
This offered NO protection against strings like this with large numbers of spaces.
So I fixed it. With my code;
var/String = ClearSpaces(T)
view(src) << "[src] says: [String]"
If the Snippets Database still existed in its organized form, I'm sure you would've found it easier. It doesn't have your "clear middle spaces" function, though.