various Tower changes

This commit is contained in:
wish
2023-06-11 18:51:56 +10:00
parent f69aebc9da
commit 2c8391b5a4
7 changed files with 225 additions and 72 deletions

View File

@@ -2,6 +2,7 @@ package stringsupport
import (
"bytes"
"fmt"
"io"
"strconv"
"strings"
@@ -96,3 +97,23 @@ func CSVElems(csv string) []int {
}
return r
}
func CSVGetIndex(csv string, i int) int {
s := CSVElems(csv)
if i < len(s) {
return s[i]
}
return 0
}
func CSVSetIndex(csv string, i int, v int) string {
s := CSVElems(csv)
if i < len(s) {
s[i] = v
}
var r []string
for j := 0; j < len(s); j++ {
r = append(r, fmt.Sprintf(`%d`, s[j]))
}
return strings.Join(r, ",")
}