Delphi - 生成GUID

uses   SysUtils;

// 生成GUID
function TForm2.GetGUID: string;
var
  LTep: TGUID;
  sGUID: string;
begin
  CreateGUID(LTep);
  sGUID := GuidToString(LTep);
  sGUID := StringReplace(sGUID, '-', '', [rfReplaceAll]);
  sGUID := Copy(sGUID, 2, length(sGUID) - 2);
  Result := sGUID;
end;

 

参考:

https://www.cnblogs.com/xwgcxk/p/7233683.html  

posted on 2021-02-11 14:47  sunylat  阅读(477)  评论(0编辑  收藏  举报