CodedK
asked on
Delete spaces in a Memo.
Hi.
How can i delete from each line in a Memo the begining spaces if there is any ?
For example:
-------------------------- ---------- ---------- ---------- -
Line 1 <--- Line 1 (two spaces)
Something <--- Line 2 (one space)
Blabla <--- Line 3 (no spaces)
Something else <--- Line 4 (five spaces)
-------------------------- ---------- ---------- ---------- -
Thanks in advance.
How can i delete from each line in a Memo the begining spaces if there is any ?
For example:
--------------------------
Line 1 <--- Line 1 (two spaces)
Something <--- Line 2 (one space)
Blabla <--- Line 3 (no spaces)
Something else <--- Line 4 (five spaces)
--------------------------
Thanks in advance.
ASKER
Hi ZhaawZ.
Thanks for your response..
Trim doesnt have any effect !
Thanks for your response..
Trim doesnt have any effect !
do you use trim() on *each* line or on whole txt?
ASKER
procedure TForm1.Button4Click(Sender : TObject);
var z:Integer;
begin
For z:=Memo1.Lines.Count-1 downto 0 do
Begin
Trim(Memo1.Lines[z]);
End;
end;
var z:Integer;
begin
For z:=Memo1.Lines.Count-1 downto 0 do
Begin
Trim(Memo1.Lines[z]);
End;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Oups...
Thank you very much :) :)
Thank you very much :) :)
glad to help ;)
btw, I have had similar "problems" with other functions before (mainly with ReplaceString()) ;)
btw, I have had similar "problems" with other functions before (mainly with ReplaceString()) ;)
n : integer;
begin
for n := 0 to Memo1.Lines.Count - 1 do Memo1.Lines[n] := trim(Memo1.Lines[n]);
end;