mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-09 15:12:26 +08:00
feat: add RandSymbolChar
This commit is contained in:
@@ -17,6 +17,7 @@ const (
|
||||
LowwerLetters = "abcdefghijklmnopqrstuvwxyz"
|
||||
UpperLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
Letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
SymbolChars = "!@#$%^&*()_+-=[]{}|;':\",./<>?"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -82,6 +83,12 @@ func RandNumeralOrLetter(length int) string {
|
||||
return random(Numeral+Letters, length)
|
||||
}
|
||||
|
||||
// RandSymbolChar generate a random symbol char(!@#$%^&*()_+-=[]{}|;':\",./<>?).
|
||||
// Play: todo
|
||||
func RandSymbolChar(length int) string {
|
||||
return random(SymbolChars, length)
|
||||
}
|
||||
|
||||
// random generate a random string based on given string range.
|
||||
func random(s string, length int) string {
|
||||
b := make([]byte, length)
|
||||
|
||||
Reference in New Issue
Block a user