跟新结构体切片

This commit is contained in:
ayflying
2025-02-11 14:26:06 +08:00
parent 9461ad77ed
commit 4862dcd1d8
3 changed files with 26 additions and 17 deletions

View File

@@ -26,7 +26,7 @@ func Excel2Slice(filePath string, _sheet ...string) [][]string {
}
// 字符串转道具类型
func (s *Excel) Spilt2Item(str string) (result [][]int64) {
func Spilt2Item(str string) (result [][]int64) {
var shadiao = []string{","}
for _, v := range shadiao {
str = strings.ReplaceAll(str, v, "|")
@@ -39,20 +39,6 @@ func (s *Excel) Spilt2Item(str string) (result [][]int64) {
parts = []string{str}
}
//var parts []string
//for _, v := range parts1 {
// parts = append(parts, strings.Split(v, ",")...) // 分割字符串
//}
//for _, v := range parts1 {
// parts2 := strings.Split(v, ",") // 分割字符串
// if parts2 == nil {
// parts = append(parts, v)
// } else {
// parts = append(parts, parts2...)
// }
//}
for i := 0; i < len(parts)-1; i += 2 {
num1, _ := strconv.ParseInt(parts[i], 10, 64)
num2, _ := strconv.ParseInt(parts[i+1], 10, 64)