mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Extend ToStrs() to support ints or strings
This commit is contained in:
parent
5620db2046
commit
f7b69fac7c
@ -6,6 +6,7 @@ import (
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/wtfutil/wtf/utils"
|
||||
@ -149,7 +150,12 @@ func ToStrs(slice []interface{}) []string {
|
||||
results := []string{}
|
||||
|
||||
for _, val := range slice {
|
||||
results = append(results, fmt.Sprintf("%v", val))
|
||||
switch val.(type) {
|
||||
case int:
|
||||
results = append(results, strconv.Itoa(val.(int)))
|
||||
case string:
|
||||
results = append(results, val.(string))
|
||||
}
|
||||
}
|
||||
|
||||
return results
|
||||
|
Loading…
x
Reference in New Issue
Block a user