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

📄 umyfunction.pas

📁 工会会员管理通用系统 数据库学习好资料 delphi编写 非常实用
💻 PAS
字号:
unit Umyfunction;

interface
uses
  Messages,SysUtils, Forms,StdCtrls ;
function GiveMedate(s:string):integer;//返回当前年份

procedure clearEdt(Frm: Tform);//请空窗体上所有文本框

function replace(s,s1,s2:string):string;//把S中的S2用S1替换


implementation

procedure clearEdt(Frm: Tform);
var
  i:integer;
begin
  //清空窗体上所有edit
  with Frm do begin
    for i:=0 to ComponentCount-1 do begin
      if (Components[i] is tedit) then
        (Components[i] as tedit).text:='';
      if (Components[i] is tcombobox) then
        (Components[i] as tcombobox).text:='';
      if (Components[i] is tmemo) then
        (Components[i] as tmemo).text:='';
    end;
  end;
end;

function replace(s,s1,s2:string):string;//把S中的S1用S2替换
var
  str:string;
  Plen,Slen,id:integer;//串长,子串长,子串位置
begin
  s:=trim(s)+' ';
  s1:=trim(s1)+' ';
  s2:=trim(s2)+' ';
  Plen:=length(s);
  Slen:=length(s1);
  id:=pos(s1,s);
  if id<1 then exit;
  str:='';
  str:=copy(s,1,id-1);
  str:=str+s2;
  str:=str+copy(s,id+Slen,Plen-(id+Slen-1));
  result:=str;
end;

function GiveMedate(s:string):integer;//返回当前年份
var
  Present: TDateTime;
  Year, Month, Day: Word;
begin
  Present:= Now;
  DecodeDate(Present, Year, Month, Day);
  if s='year' then result:=year;
  if s='month' then result:=month;
  if s='day' then result:=day;
end;



end.

⌨️ 快捷键说明

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