Go HasPrefix()

1 개요[ | ]

Go HasPrefix()
package main

import (
	"fmt"
	"strings"
)

func main() {
	str := "Hello world!"

	// true
	fmt.Println(strings.HasPrefix(str, "Hello"))
	fmt.Println(strings.HasPrefix(str, "He"))
	fmt.Println(strings.HasPrefix(str[2:], "ll"))

	// false
	fmt.Println(strings.HasPrefix(str, "ll"))
}

2 같이 보기[ | ]

3 참고[ | ]

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