没有开始,在Go中结束函数?

只是好奇于findout:为什么在Go编程语言中不存在像startswith,endswith等标准函数作为标准库的一部分?

string包包含HasPrefix和HasSuffix 。

import "strings" startsWith := strings.HasPrefix("prefix", "pre") // true endsWith := strings.HasSuffix("suffix", "fix") // true 

play.golang.org