1 Star 0 Fork 0

nggs / micro

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
util.go 990 Bytes
一键复制 编辑 原始数据 按行查看 历史
李文建 提交于 2020-04-05 00:11 . 整合其他模块代码
package static_data
import (
"fmt"
"strings"
"github.com/tealeg/xlsx"
)
func ParseSchemaString(input string) (output map[string]string) {
output = make(map[string]string)
kvs := strings.Split(input, ";")
for _, kv := range kvs {
pair := strings.Split(kv, "=")
if len(pair) == 1 {
output[strings.TrimSpace(kv)] = ""
} else if len(pair) == 2 {
output[strings.TrimSpace(pair[0])] = strings.TrimSpace(pair[1])
}
}
return
}
// 数据是否可以跳过
func CanIgnoreSheetCell(cell *xlsx.Cell) (ignore bool, err error) {
if cell == nil {
err = fmt.Errorf("cell is nil")
ignore = true
return
}
if cell.Value == "" {
err = fmt.Errorf("cell value is empty")
ignore = true
return
}
ignore = cell.Value[0] == '#'
return
}
// 行是否可以跳过
func CanIgnoreSheetRow(sheet *xlsx.Sheet, row int) (ignore bool, err error) {
if sheet == nil {
err = fmt.Errorf("sheet is nil")
ignore = true
return
}
return CanIgnoreSheetCell(sheet.Cell(row, 0))
}
Go
1
https://gitee.com/nggs/micro.git
git@gitee.com:nggs/micro.git
nggs
micro
micro
bac99dff65eb

搜索帮助

53164aa7 5694891 3bd8fe86 5694891