Go 콤마 구분 리스트를 문자열 배열로 변환

Jmnote (토론 | 기여)님의 2024년 3월 22일 (금) 17:05 판 (→‎개요)

1 개요

Go 콤마 구분 리스트를 문자열 배열로 변환
package main

import (
	"fmt"
	"strings"
)

func main() {
	input := "apple,banana,cherry,grape,kiwi"
	words := strings.Split(input, ",")
	fmt.Println(words) // [apple banana cherry grape kiwi]
}

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}