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

Jmnote (토론 | 기여)님의 2024년 3월 22일 (금) 17:05 판 (새 문서: ==개요== ;Go 콤마 구분 리스트를 문자열 배열로 변환 <syntaxhighlight lang='console'> package main import ( "fmt" "strings" ) func main() { input := "apple,banan...)
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

개요

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]
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}