zoukankan      html  css  js  c++  java
  • 开放式数组参数,我学习

    KeyLife富翁笔记
    作者: HongYuan
    标题: 开放式数组参数,我学习
    关键字: 动态数组,开放式数组参数
    分类: 个人专区
    密级: 公开
    (评分: , 回复: 0, 阅读: 603) »»

    指定类型,但不确定元素个数的开放式数组参数
    Type
      arrayChar = array char;
    procedure test(const args:arrayChar);
    var
      i:integer
    begin
      for i:=low(args) to high(args) do //setlength(args,x)
      ......
    end;

    不确定参数类型,不确定元素个数的开放式数组参数
    function test(var Args: array of const): string;
    var
      I: Integer;
    begin
      Result := '';
      for I := 0 to High(Args) do
        with Args[I] do
          case VType of
            vtInteger:    Result := Result + IntToStr(VInteger);
            vtBoolean:    Result := Result + BoolToStr(VBoolean);
            vtChar:       Result := Result + VChar;
            vtExtended:   Result := Result + FloatToStr(VExtended^);

            vtString:     Result := Result + VString^;
            vtPChar:      Result := Result + VPChar;
            vtObject:     Result := Result + VObject.ClassName;
            vtClass:      Result := Result + VClass.ClassName;
            vtAnsiString: Result := Result + string(VAnsiString);
            vtCurrency:   Result := Result + CurrToStr(VCurrency^);
            vtVariant:    Result := Result + string(VVariant^);
            vtInt64:      Result := Result + IntToStr(VInt64^);

        end;
    end;


    2005-9-15 15:02:08   
  • 相关阅读:
    python安装pip
    MySQL免安装版
    git仓库删除所有提交历史记录,成为一个干净的新仓库
    git地址带上密码,不用每次提交都输入密码
    virtualenv
    mac卸载python
    换源
    屏幕旋转,ViewController触发事件
    ViewController启动加载过程
    使用 symbolicatecrash转化crash日志
  • 原文地址:https://www.cnblogs.com/ZhouXiHong/p/568276.html
Copyright © 2011-2022 走看看