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根据网络链接截取域名

tstringgrid 添加鼠标拖动功能

Delphi xe10 针对全面屏手机端无法全面显示,下方显示黑条的处理

Delphi字符串旋转任意角度

Delphi 运行clsid文件

Delphi中怎么判断一个文件夹是否为空

Delphi 文件占坑法过360查杀

Delphi firedac fdconnection 事务

Delphi makeuniquefilename 创建文件名如果已经存在自动更改文件名

Delphi 判断字符串是否是单词

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



打赏

取消

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

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

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

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

评论

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