I am loading a text file (which contains many lines, some containing spaces or tabs) to a StringList. How can I remove whitespace (excluding newlines) from the entire StringList?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s a crude solution that assumes that tab and space are the only white space characters:
Here’s a more advanced version that will detect any whitespace:
You’ll need one of the Unicode versions of Delphi and you’ll need to use the
Characterunit.If you are using a non-Unicode version of Delphi then you would replace the if with: