strutil

package
v1.0.0-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Number       = "0123456789"
	Alphabet     = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	Alphanumeric = Alphabet + Number
)

Variables

This section is empty.

Functions

func Compact added in v1.0.0

func Compact(array []string) []string

func First added in v1.0.0

func First(array []string) string

First return first element of string array.

func Last added in v1.0.0

func Last(array []string) string

Last return last element of string array.

func Nth added in v1.0.0

func Nth(array []string, idx int) string

Nth return the nth element. if index beyond the length, return "".

func RandomAlphabet added in v1.0.0

func RandomAlphabet(n int) string

RandomAlphabet return a random n length string of alphabet.

func RandomAlphanumeric added in v1.0.0

func RandomAlphanumeric(n int) string

RandomAlphanumeric return a random n length string of alphanumeric.

func RandomNumber added in v1.0.0

func RandomNumber(n int) string

RandomNumber return a random n length string of number.

func ShortID added in v1.0.0

func ShortID() string

ShortID generate short id. Use RandomAlphanumeric(10) instead When short id generate fail.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL