Go Split()

Jmnote (토론 | 기여)님의 2020년 7월 22일 (수) 17:31 판 (Jmnote님이 Go strings.Split() 문서를 Go Split() 문서로 이동했습니다)

1 개요

Split on comma or other substring
package main

import (
	"fmt"
	"strings"
)

func main() {
	s := strings.Split("a,b,c", ",")
	fmt.Println(s)
	// Output: [a b c]
}
package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Printf("%q\n", strings.Split("a,b,c", ","))
	fmt.Printf("%q\n", strings.Split("a man a plan a canal panama", "a "))
	fmt.Printf("%q\n", strings.Split(" xyz ", ""))
	fmt.Printf("%q\n", strings.Split("", "Bernardo O'Higgins"))
}


2 같이 보기

3 참고

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