Merge pull request #72 from ZeruLight/fix/dynamic-tune-vals

dynamic tune values
This commit is contained in:
wish
2023-07-01 23:59:57 +10:00
committed by GitHub
45 changed files with 3176 additions and 501 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, ",")
}