package unsafestr import ( "fmt" "strconv" ) func Atoi(b []byte) (int, error) { return strconv.Atoi(BytesToString(b)) } func ParseInt(b []byte, base int, bitSize int) (int64, error) { return strconv.ParseInt(BytesToString(b), base, bitSize) } func ParseUint(b []byte, base int, bitSize int) (uint64, error) { return strconv.ParseUint(BytesToString(b), base, bitSize) } func ParseFloat(b []byte, bitSize int) (float64, error) { return strconv.ParseFloat(BytesToString(b), bitSize) } func Clone(s string) string { b := make([]byte, len(s)) copy(b, s) return BytesToString(b) } func ToString(v interface{}) string { if v == nil { return "" } return fmt.Sprint(v) } func InArray(s string, ss []string) bool { for _, v := range ss { if s == v { return true } } return false }