生成的GUID结果 |
语言/环境 |
代码 |
C# |
var uuid = Guid.NewGuid().ToString(); // 0e8a2792-3d8b-4bf6-8665-6b54457e5be5 36位带分隔符
var uuidN = Guid.NewGuid().ToString("N"); // c2350a89d6644f8fb158892811a94958 36位无分隔符 var uuidD = Guid.NewGuid().ToString("D"); // 953345b4-57ee-492d-976a-13b5bb199a45 36位带分隔符,与无入参一致 var uuidB = Guid.NewGuid().ToString("B"); // {2759983a-84b1-4214-af25-8989609f4801} 38位带分隔符和大括弧 var uuidP = Guid.NewGuid().ToString("P"); // (0f992b97-e024-4013-8f88-098c1a301e08) 38位带分隔符和括弧 var uuidX = Guid.NewGuid().ToString("X"); // {0x3c27d5a0,0x1263,0x4eef,{0x89,0xb2,0x2d,0x0d,0x5f,0x03,0x67,0xa3}} |
JAVA | UUID.randomUUID().toString() |
PowerShell | [System.Guid]::NewGuid().toString("B") 入参参考C# |
Linux/Shell |
UUID=$(cat /proc/sys/kernel/random/uuid)
echo ${UUD} |