⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit38.pas

📁 一个用DELPHI编的酒店管理系统。 其中数据库:SQL Server2000, 只需恢复 My database文件夹中 My database_Data.MDF和 My database_Log.
💻 PAS
字号:
unit Unit38;

interface
const
   C1 = 52845;
   C2 = 22719;
function Encrypt(const S: String; Key: Word): String;
function Decrypt(const S: String; Key: Word): String;
function isMoney(s:string):boolean;
function isInteger(s: string): boolean;

implementation
uses IdGlobal;

{字符串加密函数的实现}
function Encrypt(const S: String; Key: Word): String;
var
I: byte;
begin
  setLength(result,length(s));
  for I := 1 to Length(S) do
  begin
    Result[I] := char(byte(S[I]) xor (Key shr 8));
    Key := (byte(Result[I]) + Key) * C1 + C2;
  end;
end;
{字符串解密函数的实现}
function Decrypt(const S: String; Key: Word): String;
var
  I: byte;
begin
  setLength(result,length(s));
  for I := 1 to Length(S) do
  begin
    Result[I] := char(byte(S[I]) xor (Key shr 8));
    Key := (byte(S[I]) + Key) * C1 + C2;
  end;
end;
{判断是否为货币的函数实现}
function isMoney(s: string): boolean;
var
   i:integer;
begin
   if length(s)=0 then
   begin
      result:=false;
      exit;
   end;
   i:=1;
   while i<=length(s) do
   begin
      if (isNumeric(s[i])=false) and (s[i]<>'.') then
      begin
         result:=false;
         exit;
      end;
      i:=i+1;
   end;
   result:=true;
end;
{判断是否为整数的函数实现}
function isInteger(s: string): boolean;
var
   i:integer;
begin
   i:=1;
   if length(s)=0 then
   begin
      result:=false;
      exit;
   end;
   while i<=length(s) do
   begin
      if (isNumeric(s[i])=false) then
      begin
         result:=false;
         exit;
      end;
      i:=i+1;
   end;
   result:=true;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -