|
//Get a guid string like this : {43A6162C-308A-4112-86F8-6E6B6B76FC6E} Result := GUIDToString(guid); Result := beginSymbol + Copy(Result,2,8) + partitionSymbol + Copy(Result,11,4) + partitionSymbol + Copy(Result,16,4) + partitionSymbol + Copy(Result,21,4) + partitionSymbol + Copy(Result,26,12) + endSymbol; end; class function SSystem.GetGuidString2(guid: TGUID; beginSymbol, endSymbol, partitionSymbol: string): string; begin //Get a guid string like this : {43A6162C-308A-4112-86F8-6E6B6B76FC6E} Result := GUIDToString(guid); Result := beginSymbol + Copy(Result,26,8) + partitionSymbol + Copy(Result,34,4) + partitionSymbol + Copy(Result,16,4) + partitionSymbol + Copy(Result,2,4) + partitionSymbol + Copy(Result,6,4) + Copy(Result,11,4)+ Copy(Result,21,4)+ endSymbol; end; end. 这里有两点要说明 1. 在delphi中,日期时间有表示不是整数,这和c系列(c,c++,c#,java)是有区别的,当然这也和操作系统有区别,在windows和unix中日期时间都是整数,这也在用delphi做项目时有了不少的麻烦,因为在delphi将系统时间转化成delphi的格式时进行了除法运算,损失了数据的精度,所以在计算两个日期之间的分钟之差时会有误差,这确实是一个大问题,但是今天终于见到了delphi的这种日期时间格式的一个方便的用处,省得我自已算了. 2. 在delphi中所有的类名前都加”T”,意为Type,呵呵,有点类似于MFC中的”C”,意为”class”,在这里,我的命名方法是在前面加”S”,为了和delphi的本身类库区分,意为:” structure”,当然,如果你认为是”Sinoprise”的首字母,我也不反对. 上面是comb的算法
上一页 [1] [2] [3] [4] [VB.NET程序]Read a byte, integer or long from memory [VB.NET程序]源代码推荐:vb的GUID生成算法 [Delphi程序]在Delphi中通过函数获取GUID [Delphi程序]Integer GUID和Comb做主键的效率测试(Delphi+acce… [Delphi程序]Integer GUID和Comb做主键的效率测试(Delphi+acce…
|