我现在使用dlang语言参考我的php代码: 自己构造的一个返回uuid的函数 access public return string public static function uuid $chars = md5uniqidmt_rand true; $uuid = substr $chars 0
import std.uuid; import std.random; import std.string;
/**
- 自己构造的一个返回uuid的函数
- @access public
- @return string */ public static string uuid() { auto chars = toHexString(generateUUID()); auto uuid = chars[0..8] ~ "-" ~ chars[8..12] ~ "-" ~ chars[12..16] ~ "-" ~ chars[16..20] ~ "-" ~ chars[20..32]; return uuid; }
原文地址: http://www.cveoy.top/t/topic/fmgX 著作权归作者所有。请勿转载和采集!