我有一函数fun(a1,b1,c1:string):string;
现在我在调用的时候,b1这个参数不需要了,怎么写调用方法。总不能这样写吧fun('123','','123')
谢谢!

解决方案 »

  1.   

    function (a1,c1:string; b1:string = ''):string;
      

  2.   

    既然不需要了,可以把函数改了,去掉不需要的参数,或者在调用的时候给一个符合类型的参数就行:
    比如:('123','aaaaa','123')
      

  3.   

    把bl放到最后,实现缺省参数,可以为nil,也可以为默认值!
      

  4.   

    可以写fun('123','','123');
    既然已经明确知道不需要了,就修改声明及定义及调用就可以了
      

  5.   

    function fun(a1, b1: string; c1: string = '变态的问题就要用变态的方法'): string;
    begin
      if c1 = '变态的问题就要用变态的方法' then
      begin
        c1 := b1;
        b1 := '';
      end;
      Result := Format('a1:%s, b1:%s, c1:%s', [a1, b1, c1]);
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      ShowMessage(fun('a', 'b', 'c'));
      ShowMessage(fun('a', 'b'));
    end;
      

  6.   

    如果一个表是access的 其中字段id是自动编号 
    长整型的 
    程序中有一个变量 n:integer; 
    n:=1;
    这句'select * from xx_table where id='''+n+'''' 怎么有错呀
    说数据类型不对
    谁能指教一下
      

  7.   

    句'select * from xx_table where id='''+n+'''' 怎么有错呀n是 integer类型呀 而前面都是 string 怎么能用+呢。。你试试 +IntToStr(n) +