Documentation ¶
Index ¶
- Constants
- Variables
- func BytesAsString(b []byte) string
- func DecodeBase62String(s string) int64
- func EncodeBase62String(id int64) string
- func FindFirstDigit(s string) int
- func FindFirstNonDigit(s string) int
- func LongestCommonPrefix(s1, s2 string) string
- func MustParseF32(s string) float32
- func MustParseF64(s string) float64
- func MustParseI16(s string) int16
- func MustParseI32(s string) int32
- func MustParseI64(s string) int64
- func MustParseI8(s string) int8
- func MustParseU16(s string) uint16
- func MustParseU32(s string) uint32
- func MustParseU64(s string) uint64
- func MustParseU8(s string) uint8
- func ParseBool(s string) bool
- func ParseF32(s string) (float32, error)
- func ParseF64(s string) (float64, error)
- func ParseI16(s string) (int16, error)
- func ParseI32(s string) (int32, error)
- func ParseI64(s string) (int64, error)
- func ParseI8(s string) (int8, error)
- func ParseKeyValuePairs(text string, sep, equal byte) map[string]string
- func ParseU16(s string) (uint16, error)
- func ParseU32(s string) (uint32, error)
- func ParseU64(s string) (uint64, error)
- func ParseU8(s string) (uint8, error)
- func PrettyBytes(n int64) string
- func RandBytes(length int) []byte
- func RandString(length int) string
- func Reverse(str string) string
- func RuneWidth(r rune) int
- func StringAsBytes(s string) []byte
- func ToCamelCase(s string) string
- func ToDelimited(s string, del uint8) string
- func ToKebabCase(s string) string
- func ToLowerCamelCase(s string) string
- func ToScreamingDelimited(s string, del uint8, screaming bool) string
- func ToScreamingKebab(s string) string
- func ToScreamingSnake(s string) string
- func ToSnakeCase(s string) string
- func UnmarshalJSON(data []byte, v interface{}) error
- func WordCount(str string) int
Constants ¶
const ( KB = 1 << 10 MB = 1 << 20 GB = 1 << 30 TB = 1 << 40 )
const KVPairQuote = '\''
Variables ¶
var UTF8Len = utf8.RuneCountInString
UTF8Len is an alias of utf8.RuneCountInString which returns the number of runes in s. Erroneous and short encodings are treated as single runes of width 1 byte.
Functions ¶
func MustParseF32 ¶
func MustParseF64 ¶
func MustParseI16 ¶
func MustParseI32 ¶
func MustParseI64 ¶
func MustParseI8 ¶
func MustParseU16 ¶
func MustParseU32 ¶
func MustParseU64 ¶
func MustParseU8 ¶
func ParseKeyValuePairs ¶
解析字符串为K-V map, 示例:s = "a='x,y',c=z"
ParseSepKeyValues(s,",","=") ==> {"a":"x,y", "c":"z"}
func RuneWidth ¶
RuneWidth returns character width in monotype font. Multi-byte characters are usually twice the width of single byte characters.
Algorithm comes from `mb_strwidth` in PHP. http://php.net/manual/en/function.mb-strwidth.php
func StringAsBytes ¶
StringAsBytes returns the bytes backing a string, it is the caller's responsibility not to mutate the bytes returned. see https://pkg.go.dev/unsafe#Pointer rule(6)
func ToDelimited ¶
ToDelimited converts a string to delimited.snake.case (in this case `del = '.'`)
func ToLowerCamelCase ¶
ToLowerCamel converts a string to lowerCamelCase
func ToScreamingDelimited ¶
ToScreamingDelimited converts a string to SCREAMING.DELIMITED.SNAKE.CASE (in this case `del = '.'; screaming = true`) or delimited.snake.case (in this case `del = '.'; screaming = false`)
func ToScreamingKebab ¶
ToScreamingKebab converts a string to SCREAMING-KEBAB-CASE
func ToScreamingSnake ¶
ToScreamingSnake converts a string to SCREAMING_SNAKE_CASE
func UnmarshalJSON ¶ added in v0.1.8
使用bigint序列化大整数
Types ¶
This section is empty.