I'm writing a small app that will condense plain text copied from the clipboard. To do that, I need to remove extra spaces and linebreaks. It's ok if there's one space between characters, but I would need to change " " to " ", for example.
My first thought is that I would need to parse the text data character by character. If I find a space, I would need to see if the next character was also a space. If so, delete it.
Does that sound right or would there possibly be a faster way to do this? Also, is there a better method if I needed to remove all extra characters except for a-z, A-Z, 0-9, punctuation marks, and single spaces?
TIA,
Jas
My first thought is that I would need to parse the text data character by character. If I find a space, I would need to see if the next character was also a space. If so, delete it.
Does that sound right or would there possibly be a faster way to do this? Also, is there a better method if I needed to remove all extra characters except for a-z, A-Z, 0-9, punctuation marks, and single spaces?
TIA,
Jas