Skip to content

a simple way to generate random string with golang

License

Notifications You must be signed in to change notification settings

luliangce/randstr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RandStr

a common way to generate a random string with simple setup

package main

import (
    "github/luliangce/randstr"
    "log"
)

func main() {
    c := randstr.New(10).DisableLetter().EnableNum().Disablesymbol()
    log.Println(c.String())
}

by default:

const letter = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" //enabled
const number = "0123456789" //disabled
const symbol = `!@#$%^&*()-+=,./;'[]\<>?:"{}|` //disabled

About

a simple way to generate random string with golang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages