function GetSolidStr(const S: string): string;
var
   Len: Byte;
   FirstPos, LastPos: Byte;
begin
   Result := '';
   if S = '' then Exit;   Len := Length(S);
   FirstPos := 1;
   while (FirstPos <= Len) and
         (S[FirstPos] <= #32) do begin
      Inc(FirstPos);
   end;
   if FirstPos > Len then Exit;   for LastPos := Len downto FirstPos do begin
     if S[FirstPos] > #32 then
        Break;
   end;   Result := Copy ( S, FirstPos, LastPos - FirstPos +1 );
end;