delphi获得唯一ID字符串


本文整理自网络,侵删。

 
//这是我三层开发中常用的一个函数,直接调用CreateSortID
uses System.Win.ComObj,System.RegularExpressions,System.StrUtils,System.SysUtils;

function CreateID(ll: Integer): string; // overload;
const
  pattern: string = '[-|{|}]';
var
  MyIDStr: string;
begin
  MyIDStr := CreateClassID;
  MyIDStr := TRegEx.Replace(MyIDStr, pattern, '');
  // MyIDStr := ansiReplaceStr(MyIDStr, '-', '');
  // MyIDStr := ansiReplaceStr(MyIDStr, '{', '');
  Result := AnsiRightStr(MyIDStr, ll);
end;

function CreateSortID: string;  
begin
  Result := FormatDateTime('yyyyMMddhhmmsszzz', now) + CreateID(13);
end;

相关阅读 >>

Delphi串口通信编程

Delphi 实现对xml文件的读写操作

Delphi结构体的方法

Delphi enumwindows 获取窗体句柄 进程id 窗体信息

Delphi dbgrideh footer的设置和使用

Delphi 在firemonkey应用程序中使用torientationsensor获取设备倾斜和指南针航向

Delphi dbgrid鼠标滚屏

Delphi 获取中文/数字星期的函数

Delphi让文本框接受文件拖放

Delphi处理http请求自定义header

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



打赏

取消

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

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

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

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

评论

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