feat: add RandSymbolChar

This commit is contained in:
dudaodong committed 2023-12-07 17:56:12 +08:00
1 parent dcef06e9da
commit 6fe8a9efe7
3 files changed
+37

No files matched your search

+17
View File
@@ -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
}