mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-08 06:32:28 +08:00
feat: add RandSymbolChar
This commit is contained in:
@@ -134,3 +134,20 @@ func ExampleRandUniqueIntSlice() {
|
||||
// Output:
|
||||
// ok
|
||||
}
|
||||
|
||||
func ExampleRandSymbolChar() {
|
||||
pattern := `^[\W|_]+$`
|
||||
reg := regexp.MustCompile(pattern)
|
||||
|
||||
s := RandSymbolChar(6)
|
||||
|
||||
result1 := reg.MatchString(s)
|
||||
result2 := len(s)
|
||||
|
||||
fmt.Println(result1)
|
||||
fmt.Println(result2)
|
||||
|
||||
// Output:
|
||||
// true
|
||||
// 6
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user