From 460672bcd02eaae3dfab8d91071bc70e2abb843a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 13 Oct 2025 11:17:53 +0800 Subject: [PATCH] feat: remove doc && update json tag --- define.go | 384 +++++++++++++++--------------------------------------- string.go | 255 +----------------------------------- 2 files changed, 108 insertions(+), 531 deletions(-) diff --git a/define.go b/define.go index c7fb631..74d2660 100644 --- a/define.go +++ b/define.go @@ -9,474 +9,294 @@ package wrapper import ( "time" + + "git.zhangdeman.cn/zhangdeman/op_type" ) +// BaseTypeValueResult 基础类型结果 +type BaseTypeValueResult[BaseType op_type.BaseType] struct { + Value BaseType `json:"value"` + Err error `json:"err"` +} + // Int8Result ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:25 2023/5/8 type Int8Result struct { - Value int8 - Err error + Value int8 `json:"value"` + Err error `json:"err"` } // Int8PtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:05 2023/5/15 type Int8PtrResult struct { - Value *int8 - Err error + Value *int8 `json:"value"` + Err error `json:"err"` } // Int16Result ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:26 2023/5/8 type Int16Result struct { - Value int16 - Err error + Value int16 `json:"value"` + Err error `json:"err"` } // Int16PtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:05 2023/5/15 type Int16PtrResult struct { - Value *int16 - Err error + Value *int16 `json:"value"` + Err error `json:"err"` } // Int32Result ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:26 2023/5/8 type Int32Result struct { - Value int32 - Err error + Value int32 `json:"value"` + Err error `json:"err"` } // Int32PtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:04 2023/5/15 type Int32PtrResult struct { - Value *int32 - Err error + Value *int32 `json:"value"` + Err error `json:"err"` } // Int64Result ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:26 2023/5/8 type Int64Result struct { - Value int64 - Err error + Value int64 `json:"value"` + Err error `json:"err"` } // Int64PtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:04 2023/5/15 type Int64PtrResult struct { - Value *int64 - Err error + Value *int64 `json:"value"` + Err error `json:"err"` } // IntResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:26 2023/5/8 type IntResult struct { - Value int - Err error + Value int `json:"value"` + Err error `json:"err"` } // IntPtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:51 2023/5/15 type IntPtrResult struct { - Value *int - Err error + Value *int `json:"value"` + Err error `json:"err"` } // Uint8Result ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:28 2023/5/8 type Uint8Result struct { - Value uint8 - Err error + Value uint8 `json:"value"` + Err error `json:"err"` } // Uint8PtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:49 2023/5/16 type Uint8PtrResult struct { - Value *uint8 - Err error + Value *uint8 `json:"value"` + Err error `json:"err"` } // Uint16Result ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:28 2023/5/8 type Uint16Result struct { - Value uint16 - Err error + Value uint16 `json:"value"` + Err error `json:"err"` } // Uint16PtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:49 2023/5/16 type Uint16PtrResult struct { - Value *uint16 - Err error + Value *uint16 `json:"value"` + Err error `json:"err"` } // Uint32Result ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:28 2023/5/8 type Uint32Result struct { - Value uint32 - Err error + Value uint32 `json:"value"` + Err error `json:"err"` } // Uint32PtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:49 2023/5/16 type Uint32PtrResult struct { - Value *uint32 - Err error + Value *uint32 `json:"value"` + Err error `json:"err"` } // Uint64Result ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:28 2023/5/8 type Uint64Result struct { - Value uint64 - Err error + Value uint64 `json:"value"` + Err error `json:"err"` } // Uint64PtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:50 2023/5/16 type Uint64PtrResult struct { - Value *uint64 - Err error + Value *uint64 `json:"value"` + Err error `json:"err"` } // UintResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:29 2023/5/8 type UintResult struct { - Value uint - Err error + Value uint `json:"value"` + Err error `json:"err"` } // UintPtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:51 2023/5/16 type UintPtrResult struct { - Value *uint - Err error + Value *uint `json:"value"` + Err error `json:"err"` } // Float32Result ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:31 2023/5/8 type Float32Result struct { - Value float32 - Err error + Value float32 `json:"value"` + Err error `json:"err"` } // Float32PtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 11:10 2023/5/16 type Float32PtrResult struct { - Value *float32 - Err error + Value *float32 `json:"value"` + Err error `json:"err"` } // Float64Result ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:32 2023/5/8 type Float64Result struct { - Value float64 - Err error + Value float64 `json:"value"` + Err error `json:"err"` } // Float64PtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:52 2023/5/16 type Float64PtrResult struct { - Value *float64 - Err error + Value *float64 `json:"value"` + Err error `json:"err"` } // Any ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:40 2023/5/8 type Any struct { - Value any - Err error + Value any `json:"value"` + Err error `json:"err"` } // BoolResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:36 2023/5/8 type BoolResult struct { - Value bool - Err error + Value bool `json:"value"` + Err error `json:"err"` } // BoolPtrResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:53 2023/5/16 type BoolPtrResult struct { - Value *bool - Err error + Value *bool `json:"value"` + Err error `json:"err"` } // ObjectResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:38 2023/5/8 type ObjectResult struct { - Value map[string]any - Err error + Value map[string]any `json:"value"` + Err error `json:"err"` } // StringResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:57 2023/5/8 type StringResult struct { - Value string - Err error + Value string `json:"value"` + Err error `json:"err"` } // StringPtrResult 字符串指针 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:02 2023/5/15 type StringPtrResult struct { - Value *string - Err error + Value *string `json:"value"` + Err error `json:"err"` } // Int8SliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:49 2023/5/8 type Int8SliceResult struct { - Value []int8 - Err error + Value []int8 `json:"value"` + Err error `json:"err"` } // Int16SliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:49 2023/5/8 type Int16SliceResult struct { - Value []int16 - Err error + Value []int16 `json:"value"` + Err error `json:"err"` } // Int32SliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:50 2023/5/8 type Int32SliceResult struct { - Value []int32 - Err error + Value []int32 `json:"value"` + Err error `json:"err"` } // Int64SliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:50 2023/5/8 type Int64SliceResult struct { - Value []int64 - Err error + Value []int64 `json:"value"` + Err error `json:"err"` } // IntSliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:50 2023/5/8 type IntSliceResult struct { - Value []int - Err error + Value []int `json:"value"` + Err error `json:"err"` } // Uint8SliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:55 2023/5/8 type Uint8SliceResult struct { - Value []uint8 - Err error + Value []uint8 `json:"value"` + Err error `json:"err"` } // Uint16SliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:55 2023/5/8 type Uint16SliceResult struct { - Value []uint16 - Err error + Value []uint16 `json:"value"` + Err error `json:"err"` } // Uint32SliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:55 2023/5/8 type Uint32SliceResult struct { - Value []uint32 - Err error + Value []uint32 `json:"value"` + Err error `json:"err"` } // Uint64SliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:55 2023/5/8 type Uint64SliceResult struct { - Value []uint64 - Err error + Value []uint64 `json:"value"` + Err error `json:"err"` } // UintSliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 17:56 2023/5/8 type UintSliceResult struct { - Value []uint - Err error + Value []uint `json:"value"` + Err error `json:"err"` } // BoolSliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:22 2023/5/8 type BoolSliceResult struct { - Value []bool - Err error + Value []bool `json:"value"` + Err error `json:"err"` } // Float32SliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:24 2023/5/8 type Float32SliceResult struct { - Value []float32 - Err error + Value []float32 `json:"value"` + Err error `json:"err"` } // Float64SliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:24 2023/5/8 type Float64SliceResult struct { - Value []float64 - Err error + Value []float64 `json:"value"` + Err error `json:"err"` } // DurationResult 时间转换结果 -// -// Author : zhangdeman001@ke.com<张德满> -// -// Date : 20:32 2023/9/4 type DurationResult struct { - Value time.Duration - Err error + Value time.Duration `json:"value"` + Err error `json:"err"` } // StringSliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 15:11 2023/8/6 type StringSliceResult struct { - Value []string - Err error + Value []string `json:"value"` + Err error `json:"err"` } // MapResult 转map的结果 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:05 2023/8/10 type MapResult struct { - Value Map - Err error + Value Map `json:"value"` + Err error `json:"err"` } // AnySliceResult ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:28 2023/5/8 type AnySliceResult struct { - Value []any - Err error + Value []any `json:"value"` + Err error `json:"err"` } diff --git a/string.go b/string.go index d59aa5c..d916464 100644 --- a/string.go +++ b/string.go @@ -11,20 +11,17 @@ import ( "crypto/md5" "encoding/hex" "errors" - "git.zhangdeman.cn/zhangdeman/serialize" - "github.com/axgle/mahonia" - "github.com/spaolacci/murmur3" "io" "math/rand" "strings" "time" + + "git.zhangdeman.cn/zhangdeman/serialize" + "github.com/axgle/mahonia" + "github.com/spaolacci/murmur3" ) // StringFromRandom 从随机字符串生成String -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 14:50 2023/8/11 func StringFromRandom(length int, sourceCharList string) String { if length == 0 { return "" @@ -36,24 +33,16 @@ func StringFromRandom(length int, sourceCharList string) String { strByte := []byte(sourceCharList) var genStrByte = make([]byte, 0) r := rand.New(rand.NewSource(time.Now().UnixNano())) - for i := 0; i < int(length); i++ { + for i := 0; i < length; i++ { genStrByte = append(genStrByte, strByte[r.Intn(len(strByte))]) } - return String(string(genStrByte)) + return String(genStrByte) } // String 字符串类型包装 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:07 2023/5/5 type String string // ToFloat32 ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:26 2023/5/4 func (str String) ToFloat32() Float32Result { var ( res Float32Result @@ -63,10 +52,6 @@ func (str String) ToFloat32() Float32Result { } // ToFloat32Ptr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 11:58 2023/5/16 func (str String) ToFloat32Ptr() Float32PtrResult { res := str.ToFloat32() if nil != res.Err { @@ -82,10 +67,6 @@ func (str String) ToFloat32Ptr() Float32PtrResult { } // ToFloat64 ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:26 2023/5/4 func (str String) ToFloat64() Float64Result { var ( res Float64Result @@ -95,10 +76,6 @@ func (str String) ToFloat64() Float64Result { } // ToFloat64Ptr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 11:59 2023/5/16 func (str String) ToFloat64Ptr() Float64PtrResult { res := str.ToFloat64() if nil != res.Err { @@ -114,46 +91,26 @@ func (str String) ToFloat64Ptr() Float64PtrResult { } // ToDouble 转double -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:33 2023/5/4 func (str String) ToDouble() Float64Result { return str.ToFloat64() } // ToDoublePtr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 11:59 2023/5/16 func (str String) ToDoublePtr() Float64PtrResult { return str.ToFloat64Ptr() } // ToNumber 转数字, 使用最高精度的float64 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:33 2023/5/4 func (str String) ToNumber() Float64Result { return str.ToFloat64() } // ToNumberPtr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:00 2023/5/16 func (str String) ToNumberPtr() Float64PtrResult { return str.ToFloat64Ptr() } // ToInt8 ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:29 2023/5/4 func (str String) ToInt8() Int8Result { var ( res Int8Result @@ -163,10 +120,6 @@ func (str String) ToInt8() Int8Result { } // ToInt8Ptr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:01 2023/5/16 func (str String) ToInt8Ptr() Int8PtrResult { res := str.ToInt8() if nil != res.Err { @@ -182,10 +135,6 @@ func (str String) ToInt8Ptr() Int8PtrResult { } // ToInt16 ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:29 2023/5/4 func (str String) ToInt16() Int16Result { var ( res Int16Result @@ -195,10 +144,6 @@ func (str String) ToInt16() Int16Result { } // ToInt16Ptr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:02 2023/5/16 func (str String) ToInt16Ptr() Int16PtrResult { res := str.ToInt16() if nil != res.Err { @@ -214,10 +159,6 @@ func (str String) ToInt16Ptr() Int16PtrResult { } // ToInt32 ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:29 2023/5/4 func (str String) ToInt32() Int32Result { var ( res Int32Result @@ -227,10 +168,6 @@ func (str String) ToInt32() Int32Result { } // ToInt32Ptr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:03 2023/5/16 func (str String) ToInt32Ptr() Int32PtrResult { res := str.ToInt32() if nil != res.Err { @@ -246,10 +183,6 @@ func (str String) ToInt32Ptr() Int32PtrResult { } // ToInt64 ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:29 2023/5/4 func (str String) ToInt64() Int64Result { var ( res Int64Result @@ -259,10 +192,6 @@ func (str String) ToInt64() Int64Result { } // ToInt64Ptr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:03 2023/5/16 func (str String) ToInt64Ptr() Int64PtrResult { res := str.ToInt64() if nil != res.Err { @@ -278,10 +207,6 @@ func (str String) ToInt64Ptr() Int64PtrResult { } // ToInt ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:47 2023/5/5 func (str String) ToInt() IntResult { var ( res IntResult @@ -310,10 +235,6 @@ func (str String) ToIntPtr() IntPtrResult { } // ToUint8 ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:30 2023/5/4 func (str String) ToUint8() Uint8Result { var ( res Uint8Result @@ -323,10 +244,6 @@ func (str String) ToUint8() Uint8Result { } // ToUint8Ptr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:05 2023/5/16 func (str String) ToUint8Ptr() Uint8PtrResult { res := str.ToUint8() if nil != res.Err { @@ -342,10 +259,6 @@ func (str String) ToUint8Ptr() Uint8PtrResult { } // ToUint16 ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:29 2023/5/4 func (str String) ToUint16() Uint16Result { var ( res Uint16Result @@ -355,10 +268,6 @@ func (str String) ToUint16() Uint16Result { } // ToUint16Ptr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:05 2023/5/16 func (str String) ToUint16Ptr() Uint16PtrResult { res := str.ToUint16() if nil != res.Err { @@ -374,10 +283,6 @@ func (str String) ToUint16Ptr() Uint16PtrResult { } // ToUint32 ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:29 2023/5/4 func (str String) ToUint32() Uint32Result { var ( res Uint32Result @@ -387,10 +292,6 @@ func (str String) ToUint32() Uint32Result { } // ToUint32Ptr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:05 2023/5/16 func (str String) ToUint32Ptr() Uint32PtrResult { res := str.ToUint32() if nil != res.Err { @@ -406,10 +307,6 @@ func (str String) ToUint32Ptr() Uint32PtrResult { } // ToUint64 ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:29 2023/5/4 func (str String) ToUint64() Uint64Result { var ( res Uint64Result @@ -419,10 +316,6 @@ func (str String) ToUint64() Uint64Result { } // ToUint64Ptr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:06 2023/5/16 func (str String) ToUint64Ptr() Uint64PtrResult { res := str.ToUint64() if nil != res.Err { @@ -438,10 +331,6 @@ func (str String) ToUint64Ptr() Uint64PtrResult { } // ToUint ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:29 2023/5/4 func (str String) ToUint() UintResult { var ( res UintResult @@ -451,10 +340,6 @@ func (str String) ToUint() UintResult { } // ToUintPtr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:06 2023/5/16 func (str String) ToUintPtr() UintPtrResult { res := str.ToUint() if nil != res.Err { @@ -470,10 +355,6 @@ func (str String) ToUintPtr() UintPtrResult { } // ToBool ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:34 2023/5/4 func (str String) ToBool() BoolResult { var ( res BoolResult @@ -483,10 +364,6 @@ func (str String) ToBool() BoolResult { } // ToBoolPtr ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:07 2023/5/16 func (str String) ToBoolPtr() BoolPtrResult { res := str.ToBool() if nil != res.Err { @@ -502,10 +379,6 @@ func (str String) ToBoolPtr() BoolPtrResult { } // ToStringPtr 转换成字符串指针 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 15:57 2023/7/3 func (str String) ToStringPtr() StringPtrResult { val := str.Value() return StringPtrResult{ @@ -531,10 +404,6 @@ func (str String) ToObject() ObjectResult { } // ToStruct ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:38 2023/5/4 func (str String) ToStruct(receiver any) error { if nil == receiver { return errors.New("receiver is nil") @@ -543,10 +412,6 @@ func (str String) ToStruct(receiver any) error { } // ToInt8Slice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:55 2023/5/4 func (str String) ToInt8Slice(splitChar ...string) Int8SliceResult { result := Int8SliceResult{ Value: []int8{}, @@ -575,10 +440,6 @@ func (str String) ToInt8Slice(splitChar ...string) Int8SliceResult { } // ToInt16Slice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 19:01 2023/5/4 func (str String) ToInt16Slice(splitChar ...string) Int16SliceResult { result := Int16SliceResult{ @@ -606,10 +467,6 @@ func (str String) ToInt16Slice(splitChar ...string) Int16SliceResult { } // ToInt32Slice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 19:03 2023/5/4 func (str String) ToInt32Slice(splitChar ...string) Int32SliceResult { result := Int32SliceResult{ Value: []int32{}, @@ -636,10 +493,6 @@ func (str String) ToInt32Slice(splitChar ...string) Int32SliceResult { } // ToInt64Slice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 19:04 2023/5/4 func (str String) ToInt64Slice(splitChar ...string) Int64SliceResult { result := Int64SliceResult{ Value: []int64{}, @@ -665,10 +518,6 @@ func (str String) ToInt64Slice(splitChar ...string) Int64SliceResult { } // ToIntSlice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 19:04 2023/5/4 func (str String) ToIntSlice(splitChar ...string) IntSliceResult { result := IntSliceResult{ Value: []int{}, @@ -695,10 +544,6 @@ func (str String) ToIntSlice(splitChar ...string) IntSliceResult { } // ToUint8Slice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:50 2023/5/5 func (str String) ToUint8Slice(splitChar ...string) Uint8SliceResult { result := Uint8SliceResult{ Value: []uint8{}, @@ -725,10 +570,6 @@ func (str String) ToUint8Slice(splitChar ...string) Uint8SliceResult { } // ToUint16Slice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:52 2023/5/5 func (str String) ToUint16Slice(splitChar ...string) Uint16SliceResult { result := Uint16SliceResult{ Value: []uint16{}, @@ -755,10 +596,6 @@ func (str String) ToUint16Slice(splitChar ...string) Uint16SliceResult { } // ToUint32Slice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:53 2023/5/5 func (str String) ToUint32Slice(splitChar ...string) Uint32SliceResult { result := Uint32SliceResult{ Value: []uint32{}, @@ -785,10 +622,6 @@ func (str String) ToUint32Slice(splitChar ...string) Uint32SliceResult { } // ToUint64Slice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:54 2023/5/5 func (str String) ToUint64Slice(splitChar ...string) Uint64SliceResult { result := Uint64SliceResult{ Value: []uint64{}, @@ -814,10 +647,6 @@ func (str String) ToUint64Slice(splitChar ...string) Uint64SliceResult { } // ToUintSlice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:54 2023/5/5 func (str String) ToUintSlice(splitChar ...string) UintSliceResult { result := UintSliceResult{ Value: []uint{}, @@ -844,10 +673,6 @@ func (str String) ToUintSlice(splitChar ...string) UintSliceResult { } // ToBoolSlice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:55 2023/5/5 func (str String) ToBoolSlice(splitChar ...string) BoolSliceResult { result := BoolSliceResult{ Value: []bool{}, @@ -874,10 +699,6 @@ func (str String) ToBoolSlice(splitChar ...string) BoolSliceResult { } // ToFloat32Slice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:56 2023/5/5 func (str String) ToFloat32Slice(splitChar ...string) Float32SliceResult { result := Float32SliceResult{ Value: []float32{}, @@ -903,10 +724,6 @@ func (str String) ToFloat32Slice(splitChar ...string) Float32SliceResult { } // ToFloat64Slice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:56 2023/5/5 func (str String) ToFloat64Slice(splitChar ...string) Float64SliceResult { result := Float64SliceResult{ Value: []float64{}, @@ -933,28 +750,16 @@ func (str String) ToFloat64Slice(splitChar ...string) Float64SliceResult { } // ToDoubleSlice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:57 2023/5/5 func (str String) ToDoubleSlice(splitChar ...string) Float64SliceResult { return str.ToFloat64Slice(splitChar...) } // ToNumberSlice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 10:57 2023/5/5 func (str String) ToNumberSlice(splitChar ...string) Float64SliceResult { return str.ToFloat64Slice(splitChar...) } // ToDuration 转换为时间格式 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 20:31 2023/9/4 func (str String) ToDuration(timeUnit time.Duration) DurationResult { int64Val := str.ToInt64() if nil != int64Val.Err { @@ -967,10 +772,6 @@ func (str String) ToDuration(timeUnit time.Duration) DurationResult { } // ToStringSlice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 15:11 2023/8/6 func (str String) ToStringSlice(splitChar ...string) StringSliceResult { result := StringSliceResult{ Value: []string{}, @@ -987,10 +788,6 @@ func (str String) ToStringSlice(splitChar ...string) StringSliceResult { } // ToAnySlice ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 15:01 2023/5/5 func (str String) ToAnySlice(splitCharList ...string) AnySliceResult { result := AnySliceResult{ Value: []any{}, @@ -1023,10 +820,6 @@ func (str String) ToAnySlice(splitCharList ...string) AnySliceResult { } // Md5 计算Md5值 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:08 2023/5/16 func (str String) Md5() StringResult { h := md5.New() _, err := io.WriteString(h, str.Value()) @@ -1043,19 +836,11 @@ func (str String) Md5() StringResult { } // Value ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 12:11 2023/5/16 func (str String) Value() string { return string(str) } // GetLetterList 获取字母列表 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 14:53 2023/8/11 func (str String) GetLetterList() []string { return []string{ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", @@ -1064,10 +849,6 @@ func (str String) GetLetterList() []string { } // SnakeCaseToCamel 蛇形字符串转换为驼峰 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 4:58 下午 2021/10/25 func (str String) SnakeCaseToCamel() string { if len(str) == 0 { return "" @@ -1097,10 +878,6 @@ func (str String) SnakeCaseToCamel() string { } // Convert 字符串编码转换 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 14:38 2022/7/9 func (str String) Convert(sourceCode string, targetCode string) String { sourceCoder := mahonia.NewDecoder(sourceCode) sourceResult := sourceCoder.ConvertString(str.Value()) @@ -1110,10 +887,6 @@ func (str String) Convert(sourceCode string, targetCode string) String { } // ClearChar 清理指定字符 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 14:59 2023/8/11 func (str String) ClearChar(charList ...string) String { if len(charList) == 0 { return str @@ -1126,10 +899,6 @@ func (str String) ClearChar(charList ...string) String { } // ReplaceChineseChar 替换常见的中文符号 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 16:59 2023/4/4 func (str String) ReplaceChineseChar() String { charTable := map[string]string{ "(": "(", @@ -1144,10 +913,6 @@ func (str String) ReplaceChineseChar() String { } // ReplaceChar 替换指定字符 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 15:01 2023/8/11 func (str String) ReplaceChar(charTable map[string]string) String { if len(charTable) == 0 { return str @@ -1160,10 +925,6 @@ func (str String) ReplaceChar(charTable map[string]string) String { } // HasSubStr 是否包含指定的子串 -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 18:37 2024/4/19 func (str String) HasSubStr(subStrList []string) bool { if len(subStrList) == 0 { return true @@ -1178,10 +939,6 @@ func (str String) HasSubStr(subStrList []string) bool { } // HashNumber ... -// -// Author : go_developer@163.com<白茶清欢> -// -// Date : 11:05 2024/6/27 func (str String) HashNumber() Uint64Result { return Uint64Result{ Value: murmur3.Sum64([]byte(str.Value())),