23 lines
408 B
Go
23 lines
408 B
Go
package parsers
|
|
|
|
import (
|
|
"strconv"
|
|
"strings"
|
|
)
|
|
|
|
func atoi(s string) (int, bool) {
|
|
v, err := strconv.Atoi(s)
|
|
if err != nil {
|
|
return 0, false
|
|
}
|
|
return v, true
|
|
}
|
|
|
|
func TrimPrefixSuffix(arr []string, prefix, suffix string) []string {
|
|
trims := make([]string, 0, len(arr))
|
|
for _, str := range arr {
|
|
trims = append(trims, strings.TrimSuffix(strings.TrimPrefix(str, prefix), suffix))
|
|
}
|
|
return trims
|
|
}
|