home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
hamradio
/
wnode230.zip
/
UTILS.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-03-14
|
2KB
|
90 lines
Unit Utils;
{ Very simple utilities for WNodelst.Pas }
{ and WNldemo.Pas. }
{ See WNodelst.Pas for references. }
Interface
Function Word_Upcase(Frase:String):String;
Function Val2(St:String):Longint;
Function CmpSort(Stringa1,Stringa2:String):Byte;
Function FileExists(Nome_Del_File:String):Boolean;
Implementation
Uses
Dos;
Function FileExists(Nome_Del_File:String):Boolean;
Var
SRec:SearchRec;
Begin
FindFirst(Nome_Del_File,Archive,SRec);
FileExists:=DosError=0
end;
Function CmpSort(Stringa1,Stringa2:String):Byte;
Var
Pos:Byte;
Exit:Byte;
Begin
Pos:=1;
Exit:=0;
While (Pos<=Length(Stringa1)) and (Pos<=Length(Stringa2))
and (Exit=0) do
Begin
If Stringa1[Pos]<Stringa2[Pos] then
Exit:=1
else
If Stringa1[Pos]>Stringa2[Pos] then
Exit:=2;
Inc(Pos);
end;
If Exit=0 then
Begin
If Length(Stringa1)<Length(Stringa2) then
Exit:=1
else
If Length(Stringa1)>Length(Stringa2) then
Exit:=2
else
Exit:=3;
end;
CmpSort:=Exit;
end;
Function Val2(St:String):Longint;
Const
StrNum:Array[0..9] of Char=('0','1','2','3','4','5','6','7','8','9');
Var
Conta,Conta1:Byte;
Res,Pot:Longint;
Begin
Res:=0;
Pot:=1;
For Conta:=Length(St) downto 1 do
Begin
Conta1:=0;
While (UpCase(St[Conta])<>(StrNum[Conta1])) and (Conta1<11) do
Inc(Conta1);
If Conta<>Length(St) then
Pot:=Pot*10;
Res:=Res+Pot*(Conta1);
end;
Val2:=Res;
end;
Function Word_Upcase(Frase:String):String;
Var
Kunta:Integer;
Begin
For Kunta:=1 to Length(Frase) do
Frase[Kunta]:=UpCase(Frase[Kunta]);
Word_UpCase:=Frase;
end;
Begin
end.