From: qydysky Date: Mon, 11 Nov 2024 14:31:04 +0000 (+0800) Subject: 1 X-Git-Tag: v0.28.20241111145249~1 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=7780e9cb95c6a05bb11ff59c2d5fde072515749a;p=part%2F.git 1 --- diff --git a/strings/Strings.go b/strings/Strings.go index 05d3149..467a048 100644 --- a/strings/Strings.go +++ b/strings/Strings.go @@ -8,19 +8,23 @@ import ( ) const ( - Number RandType = 0 - LowNumber RandType = 1 - UppNumber RandType = 2 + Number RandType = iota + Hex + LowNumber + UppNumber ) type RandType int func Rand(typel RandType, leng int) string { source := "0123456789" - if typel > 0 { - source += "abcdefghijklmnopqrstuvwxyz" + if typel >= Hex { + source += "abcdef" } - if typel > 1 { + if typel >= LowNumber { + source += "ghijklmnopqrstuvwxyz" + } + if typel >= UppNumber { source += "ABCDEFGHIJKLMNOPQRSTUVWXYZ" }