📌  相关文章
📜  go string to int array with space separator - Go 编程语言 - Go 编程语言代码示例

📅  最后修改于: 2022-03-11 14:44:59.162000             🧑  作者: Mango

代码示例1
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
}