频道分类

delphi 根据文件扩展名判断文件类型函数写法

作者:admin 来源: 日期:2020/3/27 22:39:05 人气: 标签:

 
function IsImageFile(const fn: string): Boolean;
var
  extfn:String;
begin
  extfn := LowerCase(ExtractFileExt(fn));
  Result := (extfn = '.jpg') or
            (extfn = '.jpeg') or
            (extfn = '.gif') or
            (extfn = '.png') or
            (extfn = '.bmp');
end;

function IsMovieFile(const fn: string): Boolean;
var
  extfn:String;
begin
  extfn := LowerCase(ExtractFileExt(fn));
  Result := (extfn = '.rmvb') or
            (extfn = '.rm') or
            (extfn = '.mov') or
            (extfn = '.mkv') or
            (extfn = '.avi') or
            (extfn = '.flv');
end;

function IsTxtFile(const fn: string): Boolean;
var
  extfn:String;
begin
  extfn := LowerCase(ExtractFileExt(fn));
  Result := (extfn = '.txt') or
            (extfn = '.csv') or
            (extfn = '.cvs') or
            (extfn = '.scv');
end;

上一篇:delphi 从记事本导入记录下一篇:没有资料