Var B,old:ansistring; begin B:=(memo1.text); repeat old:=B; B:=StringReplace(B, #32#32, #32,[rfReplaceAll]); until B=old; memo1.text:=B; end;