diff --git a/const.go b/const.go index 30e76b1..78c13c9 100644 --- a/const.go +++ b/const.go @@ -1,10 +1,8 @@ package gox const ( - // StringEmpty 空字符串 - StringEmpty = "" - StringSpace = " " + stringEmpty = "" + stringSpace = " " - // Float64Size 64位长度 - Float64Size = 64 + float64Size = 64 ) diff --git a/itoa.go b/itoa.go index 6376439..38ec72e 100644 --- a/itoa.go +++ b/itoa.go @@ -127,8 +127,8 @@ func Atoid(num string) int64 { // Atoi 增强版进制转换,支持任意进制,最大76进制 func Atoi(num string, base int) int64 { final := 0.0 - length := len(strings.Split(num, StringEmpty)) - 1 - for _, value := range strings.Split(num, StringEmpty) { + length := len(strings.Split(num, stringEmpty)) - 1 + for _, value := range strings.Split(num, stringEmpty) { tmp := float64(findKey(value)) if -1 != tmp { final = final + tmp*math.Pow(float64(base), float64(length)) diff --git a/size.go b/size.go index abcfe50..6a2ba6a 100644 --- a/size.go +++ b/size.go @@ -23,7 +23,7 @@ type Size int64 // ParseSize 解析字节大小 func ParseSize(from string) (size Size, err error) { // 逐步解析各个容量 - for _, volume := range strings.Split(from, StringSpace) { + for _, volume := range strings.Split(from, stringSpace) { var unit, num string length := len(volume) check := volume[length-2] @@ -37,7 +37,7 @@ func ParseSize(from string) (size Size, err error) { // 计算数字大小 var capacity float64 - if capacity, err = strconv.ParseFloat(num, Float64Size); nil != err { + if capacity, err = strconv.ParseFloat(num, float64Size); nil != err { return } diff --git a/string_builder.go b/string_builder.go index 9ea436e..0c1860b 100644 --- a/string_builder.go +++ b/string_builder.go @@ -10,7 +10,7 @@ type stringBuilder struct { buffer *bytes.Buffer } -// 创建连写字符串 +// StringBuilder 创建连写字符串 func StringBuilder(items ...any) (sb *stringBuilder) { sb = new(stringBuilder) sb.buffer = new(bytes.Buffer)