Documentation
¶
Index ¶
- func IDToRef(id uint, prefix string, length int, refChars, refPaddingChars string) (string, error)
- func RefToID(ref, prefix string, refChars, refPaddingChars string) (uint64, error)
- func String2Uint(s string, chars, paddingChars string) (n uint64, err error)
- func Uint2String(number uint64, chars, paddingChars string, length int) (s string, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func String2Uint ¶
String2Uint is the revert of Uint2String
It returns negative result in 2 cases: - s contains character not exist in chars - the result is bigger than max int64 (integer overflow happen)
func Uint2String ¶
Uint2String converts a number to a string using characters from chars.
Validation:
- `length` must > 0
- length of `chars` must >= 10
- `paddingChars` must not be empty
- `chars` & `paddingChars` must not overlap
If length of the result < required length, the result will be left padded with random characters from `paddingChars`.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.