Go Index()

Jmnote (토론 | 기여)님의 2023년 4월 25일 (화) 18:11 판
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

Go Index()
Go 문자열 Index()
Go strings.Index()
package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Println(strings.Index("chicken", "ken"))
	fmt.Println(strings.Index("chicken", "dmr"))
}
package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Println(strings.Index("hello world", "h"))  // 0
	fmt.Println(strings.Index("hello world", "l"))  // 2
	fmt.Println(strings.Index("hello world", "ll")) // 2
	fmt.Println(strings.Index("hello world", "z"))  // -1
}

2 같이 보기[ | ]

3 참고[ | ]

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