本文整理自网络,侵删。
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);begincaption:=GetStyle('红色',ParseStyles('红色:红色路径'));end;
//国外看到得片段。
相关阅读 >>
Delphi xe10 针对全面屏手机端无法全面显示,下方显示黑条的处理
Delphi firedac fdconnection 事务
Delphi makeuniquefilename 创建文件名如果已经存在自动更改文件名
更多相关阅读请进入《Delphi》频道 >>