Link to home
Start Free TrialLog in
Avatar of Wayne Barron
Wayne BarronFlag for United States of America

asked on

Delete "White Spaces" in TMemo

Hello All;

   I need to "Delete White Spaces"

I need all White Spaces in a TMemo to be deleted.

Example:
( Memo Outline )

-------------TOP----------------


above is "3" White Spaces
Below is "3" White Spaces



------------Bottom--------------

I need to have this located under a Button.

Any idea's on this will be great.

carrzkiss
Avatar of Wim ten Brink
Wim ten Brink
Flag of Netherlands image

To remove spaces:
Memo1.Lines.Text := StringReplace(Memo1.Lines.Text, #32, '', [rfReplaceAll]);

To remove empty lines:
Memo1.Lines.Text := StringReplace(Memo1.Lines.Text, #13#10#13#10, #13#10, [rfReplaceAll]);
ASKER CERTIFIED SOLUTION
Avatar of Pierre Cornelius
Pierre Cornelius
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Wayne Barron

ASKER

Thank you [Pierre];

  Your code works very well.

Thank You for your time again, in this post.
I awarded you the points because your code works well.
Even though with the last question that I asked, that you both
Were a part of, this code here does it all.

for Q :=Memo1.Lines.Count -1 downto 0 do
 begin
  if pos( 'http://', lowercase(Memo1.Lines[Q]) ) = 0
   then Memo1.Lines.Delete(Q);
 end;

https://www.experts-exchange.com/questions/21123097/Delete-Characters-that-do-not-begin-with-http-in-TMemo.html

From Everst

Thank you all

Wayne