当前位置:网站首页>delphi-UUID
delphi-UUID
2022-06-25 06:17:00 【Listest】
The code is as follows
function GetLocalKID(guidstr: string; StrLength: Integer): string;
var
CID, Res : string;
L, I1, I2, I3, K1, K2: Integer;
const
F = '0123456789ABCDEF';
T = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-';
begin
CID := guidstr;
CID := ReplaceStr(CID, '{', '');
CID := ReplaceStr(CID, '}', '');
CID := ReplaceStr(CID, '-', '') + '0';
if StrLength = 33 then
begin
Result := CID;
end
else if StrLength = 22 then
begin
Res := '';
L := 1;
while L < 33 do
begin
I1 := Pos(Copy(CID, L, 1), F);
I2 := Pos(Copy(CID, L + 1, 1), F);
I3 := Pos(Copy(CID, L + 2, 1), F);
K1 := I1 * 4 + Trunc(I2 / 16);
K2 := (I2 mod 16) * 4 + I3;
Res := Res + Copy(T, K1, 1) + Copy(T, K2, 1);
L := L + 3;
end;
L := Length(Res);
while L < 22 do
begin
Res := Res + '0';
L := L + 1;
end;
Result := Res;
end;
end;2. Use
function LocalKID(StrLength: Integer = 22): string;
var
tmpGUID : TGUID;
begin
CreateGUID(tmpGUID);
Result := GetLocalKID(GUIDToString(tmpGUID), StrLength);
end;边栏推荐
- Processes and threads - concepts and process scheduling
- Analysis report on investment and financing status and operation benefits of global and Chinese dental industry (2022 Edition)
- Distributed solar photovoltaic inverter monitoring
- Lesson 9: workspace introduction
- What are the reasons why most webmasters choose Hong Kong site group servers?
- [data visualization application] draw spatial map (with R language code)
- Investment opportunities and operational risk assessment report of China's engineering consulting industry during the 14th Five Year Plan period 2022-2028
- Research Report on brand strategic management and marketing trends in the global and Chinese preserved fruit market 2022
- Lesson 8: FTP server setup and loading
- Notes on dashboard & kuboard installation in kubernetes cluster
猜你喜欢

C switch nested syntax

Hands on deep learning (III)

Monitoring access: how to grant minimum WMI access to the monitoring service account
![[open source sharing] deeply study KVM, CEPH, fuse features, including open source projects, code cases, articles, videos, architecture brain maps, etc](/img/9d/9bcf52f521e92cf97eb1d545931c68.jpg)
[open source sharing] deeply study KVM, CEPH, fuse features, including open source projects, code cases, articles, videos, architecture brain maps, etc
Interviewer: what is an iterator? What is the relationship between async await and iterators?

How to use asemi FET 7n80 and how to use 7n80

Asemi fast recovery diode us1m parameters, us1m recovery time, us1m voltage drop

Three tier architecture experiment

BGP - basic concept

The elephant turns around and starts the whole body. Ali pushes Maoxiang not only to Jingdong
随机推荐
Noi Mathematics: Dirichlet convolution
Aiot project that is an introduction to the basics of the Internet of things and can be implemented in practice
Technology inventory: Technology Evolution and Future Trend Outlook of cloud native Middleware
PHP and WMI – explore windows with PHP
Summary of 6 common methods of visual deep learning model architecture
证券如何在线开户?在线开户是安全么?
Huawei machine test question: splicing URL
IQ debugging of Hisilicon platform ISP and image (1)
Yunda's cloud based business in Taiwan construction 𞓜 practical school
Analysis report on investment and financing status and operation benefits of global and Chinese dental industry (2022 Edition)
Guess the size of the number
Soft exam information system project manager_ Information system security management - Senior Information System Project Manager of soft test 026
Use generator-easy-ui5 to quickly create the engineering structure of SAP ui5 applications
Getting started with mongodb
Tail command – view the contents at the end of the file
Es11 new methods: dynamic import(), bigint, globalthis, optional chain, and null value merging operator
Introduction to the main features of kyma when the cloud native application runs
[Suanli network] problems and challenges faced by the development of Suanli network
Differences and connections between sap ui5 and openui5
SAP Fiori tools and corresponding cli (command line interface)