1 개요[ | ]
- Go Index()
- Go 문자열 Index()
- Go strings.Index()
Go
CPU
-1.0s
MEM
-0M
-1.0s
Copy
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Println(strings.Index("chicken", "ken"))
fmt.Println(strings.Index("chicken", "dmr"))
}
4 -1
Go
Copy
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
}
Loading
2 같이 보기[ | ]
3 참고[ | ]
편집자 Jmnote
로그인하시면 댓글을 쓸 수 있습니다.