function FormatSt( S: String; BasSon,Count: Integer; Chr: Char):String;
 var
  j,i : Integer ;
  tmpChr : String ;
begin
  i := Length(S) ;
  tmpChr := '' ;
  if i = 0 then
    for j:= 1 to (Count) do tmpChr := tmpChr + Chr
  else
    for j:= 1 to (Count - i) do tmpChr := tmpChr + Chr ;
  if BasSon = 1 then
    Result := tmpChr + S
  else
    Result :=  S + tmpChr ;
end;