Use DeleteSpaces function. For example: Edit2.Text:=DeleteSpaces(Edit1.Text); DeleteSpaces function is so:
function DeleteSpaces(Str: string): string;
var
i: Integer;
begin
i:=0;
while i<=Length(Str) do
if Str[i]=' ' then Delete(Str, i, 1)
else Inc(i);
Result:=Str;
end;