Documentation ¶
Index ¶
- Variables
- func B2S(b []byte) string
- func BytesToString(b []byte) string
- func CopyBytes(b []byte) []byte
- func CopySliceString(slice []string) []string
- func CopyString(s string) string
- func EqualBytes(a, b []byte) bool
- func EqualSlicesString(slice1, slice2 []string) bool
- func ExtendBytes(b []byte, needLen int) []byte
- func Float(in interface{}) (float64, error)
- func IncludeString(slice []string, s string) bool
- func IndexOfString(slice []string, s string) int
- func Int(in interface{}) (int, error)
- func Int64(in interface{}) (int64, error)
- func IsContainCNString(str string) bool
- func MustFloat(in interface{}) float64
- func MustInt(in interface{}) int
- func MustInt64(in interface{}) int64
- func MustUint(in interface{}) uint64
- func PrependBytes(dst []byte, src ...byte) []byte
- func PrependStringBytes(dst []byte, src string) []byte
- func RandBytes(dst []byte) []byte
- func ReverseSliceString(slice []string) []string
- func ReverseString(s string) string
- func S2B(s string) (b []byte)
- func StringToBytes(s string) []byte
- func ToFloat(in interface{}) (f64 float64, err error)
- func ToInt(in interface{}) (iVal int, err error)
- func ToInt64(in interface{}) (i64 int64, err error)
- func ToString(src interface{}) string
- func ToUint(in interface{}) (u64 uint64, err error)
- func Uint(in interface{}) (uint64, error)
- func UniqueAppendString(slice []string, s ...string) []string
Constants ¶
This section is empty.
Variables ¶
var (
ErrConvertFail = errors.New("convert data type is failure")
)
Functions ¶
func B2S ¶
B2S converts byte slice to a string without memory allocation. See https://groups.google.com/forum/#!msg/Golang-Nuts/ENgbUzYvCuU/90yGx7GUAgAJ .
func BytesToString ¶
func CopySliceString ¶
CopySliceString returns a copy of the slice.
func CopyString ¶
CopyString returns a copy of string in a new pointer.
func EqualBytes ¶
EqualBytes reports whether a and b are the same length and contain the same bytes. A nil argument is equivalent to an empty slice.
func EqualSlicesString ¶
EqualSlicesString checks if the slices are equal.
func ExtendBytes ¶
ExtendBytes extends b to needLen bytes.
func IncludeString ¶
IncludeString returns true or false if given string is in slice.
func IndexOfString ¶
IndexOfString returns index position in slice from given string If value is -1, the string does not found.
func IsContainCNString ¶
IsContainCNString 判断字符串是否为中文[精确度需要反复试验]
func PrependBytes ¶
PrependBytes prepends bytes into a given byte slice.
func PrependStringBytes ¶
PrependStringBytes prepends a string into a given byte slice.
func RandBytes ¶
RandBytes returns dst with a string random bytes Make sure that dst has the length you need.
func ReverseSliceString ¶
ReverseSliceString reverses a string slice.
func S2B ¶
S2B converts string to a byte slice without memory allocation.
Note it may break if string and/or slice header will change in the future go versions.
func StringToBytes ¶
func UniqueAppendString ¶
UniqueAppendString appends a string if not exist in the slice.
Types ¶
This section is empty.