]> 127.0.0.1 Git - part/.git/commitdiff
1
authorqydysky <qydysky@foxmail.com>
Mon, 11 Nov 2024 14:31:04 +0000 (22:31 +0800)
committerqydysky <qydysky@foxmail.com>
Mon, 11 Nov 2024 14:31:04 +0000 (22:31 +0800)
strings/Strings.go

index 05d31497978b2640f4996869ff2d33a51bc1ba6b..467a0488c15442e2b33cb13ee1272eecbe2062f2 100644 (file)
@@ -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"
        }