如C++ 一样: public string getFileName( string myDir)
{
  if (myDir.length > 256)
     return null;
...
}
---------------
delphi中怎么做?(如上面一样提前提出函数)

解决方案 »

  1.   

    function getFileName(myDir: string): string;
    begin
      if Length(myDir) > 256 then begin
        Result := '';
        Exit;
      end;
    ...
    end;
      

  2.   

    如:
    function getFileName(myDir: string): string;
    begin
      if Length(myDir) > 256 then begin
        Result := ''; //可以是resukt返回,也可以是:getfilename:=返回
        Exit;
      end;
    ...
    end;
      

  3.   

    function getFileName(myDir: string): string;
    begin
      if Length(myDir) > 256 then 
      begin
        Result := '';
        Exit;
      end;
    ...
    end;
      

  4.   

    thanks 
    happy christmas~~