From 7780e9cb95c6a05bb11ff59c2d5fde072515749a Mon Sep 17 00:00:00 2001 From: qydysky Date: Mon, 11 Nov 2024 22:31:04 +0800 Subject: [PATCH] 1 --- strings/Strings.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) 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" } -- 2.39.2