Answers for "go string to int array with space separator"

Go
0

go string to int array with space separator

func strToIntArr(s string) []int {
    strs := strings.Split(s, " ")
    res := make([]int, len(strs))
    for i := range res {
        res[i], _ = strconv.Atoi(strs[i])
    }    
    return res
}
Posted by: Guest on March-29-2021

Code answers related to "go string to int array with space separator"

Browse Popular Code Answers by Language