如题,可以不管后缀,只要判断 . 的前面是符合文件名规则的就好了,该怎么判断呐?

解决方案 »

  1.   

    文件名不能包括unicode字符(w98),也不能包括:\/:*?"<>|
      

  2.   

    文件名的命名规则:
    1.不能全部是空格
    2.文件名不能包括以下字符:
      \/:*?"<>|代码如下:
    function isFileName(strFileName: string): Boolean;
    var
      i: Integer;
    begin
      Result := True;
      if Trim(strFileName) = '' then Result  := False;
      for i := 1 to Length(strFileName) do
      begin
        if strFileName[i] in [ '\','/',':','*','?','"','<','>','|'] then
        begin
          Result := False;
          Break;
        end;
      end;
    end;