Delphi TArray<TArray<string>> 用法


本文整理自网络,侵删。

 

uses Generics.Collections, Generics.Defaults;

function ParseStyles(const style: string): TArray>;

var
  sa, sa2: TArray;
  I: Integer;
begin
  if style = '' then
    SetLength(Result, 0, 0);
  sa := style.Split([';']);
  SetLength(Result, Length(sa), 2);
  for I := 0 to High(sa) do
  begin
    sa2 := sa[I].Split([':']);
    if Length(sa2) = 2 then
    begin
      Result[I, 0] := sa2[0];
      Result[I, 1] := sa2[1];
    end;
  end;
end;

function GetStyle(const key: string; const styles: TArray>): string;
var
  I: Integer;
begin
  for I := 0 to High(styles) do
  begin
    if styles[I,0] = key then
    begin
      Exit(styles[I, 1]);
    end;
  end;
  Result := '';
end;

procedure TForm16.FormCreate(Sender: TObject);
begin
caption:=GetStyle('红色',ParseStyles('红色:红色路径'));
end;

//国外看到得片段。

相关阅读 >>

Delphi如何开发游戏外挂

Delphi获取本地全部盘符并存如combobox1

Delphi 防止程序重复执行的单元

Delphi 在 webservice 中采用 tsoapattachment 传输文件

Delphi中动态加载treeview信息

Delphi 从资源文件中加载字符

Delphi 进程隐藏的若干方法

Delphi setwindowshookex - 设置钩子 unhookwindowshookex - 卸掉钩子

Delphi中限制鼠标的移动区域

Delphi解析json格式化的日期

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...