Código: Seleccionar todo
function sTrim(lpStr:string):String;
var
i: Integer;
begin
If Length(lpStr) > 0 Then
begin
for i := 1 to Length(lpStr) do begin
If Copy(lpStr,i,1) = ' ' Then begin
If (Copy(lpStr,i,1) = ' ') And (Copy(lpStr,i + 1,1) <> ' ') And (Copy(lpStr,i - 1,1) <> ' ')Then Result:= Result + Copy(lpStr,i,1);
Result:= Result + '';
end else
Result:= Result + Copy(lpStr,i,1)
end;
end;
end;