1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
// @Title: Excel 表中某个范围内的单元格 (Cells in a Range on an Excel Sheet)
// @Author: 15816537946@163.com
// @Date: 2022-03-06 10:51:12
// @Runtime: 4 ms
// @Memory: 3.2 MB
func cellsInRange(s string) []string {
	ps := strings.Split(s, ":")
	a := ps[0]
	b := ps[1]
	ret := make([]string, 0)
	for i := a[0]; b[0] >= i; i++ {
		for j := a[1]; b[1] >= j; j++ {
			ret = append(ret, fmt.Sprintf("%s%d", string(i), j-'0'))
		}
	}
	return ret

}