Subversion Repositories oidplus

Compare Revisions

Regard whitespace Rev 739 → Rev 740

/trunk_dos/VTSFUNCS.PAS
20,9 → 20,11
procedure Beep;
 
function Trim(s: string): string;
function TrimLineToWidth(s: string; width: integer): string;
function ZeroPad(i: LongInt; n: integer): string;
function LeftPadStr(s: string; n: integer; ch: char): string;
function RightPadStr(s: string; n: integer; ch: char): string;
function RepeatStr(ch: char; n: integer): string;
 
function DeleteFile(filename: string): boolean;
function FileExists(filename: string): boolean;
110,6 → 112,16
Trim := s;
end;
 
function TrimLineToWidth(s: string; width: integer): string;
begin
(* TODO: Put into VTSUTILS, also use for VTSCUI menu *)
if Length(s) > width then
begin
s := Copy(s, 1, width-3) + '...';
end;
TrimLineToWidth := s;
end;
 
function ZeroPad(i: LongInt; n: integer): string;
var
s: string;
136,6 → 148,19
RightPadStr := s;
end;
 
function RepeatStr(ch: char; n: integer): string;
var
i: integer;
res: string;
begin
res := '';
for i := 1 to n do
begin
res := res + ch;
end;
RepeatStr := res;
end;
 
function DeleteFile(filename: string): boolean;
var
F: file;
167,8 → 192,16
{$I-}
Reset(F);
{$I+}
FileExists := IoResult = 0;
if IoResult = 0 then
begin
Close(F);
FileExists := true;
end
else
begin
FileExists := false;
end;
end;
 
function IsPositiveInteger(s: string): boolean;
var