好奇的是:为什么Go编程语言的标准库中没有标准函数,比如startswith、endswith等?
发布于 2012-11-06 11:49:43
strings包包含HasPrefix和HasSuffix。
import "strings"
startsWith := strings.HasPrefix("prefix", "pre") // true
endsWith := strings.HasSuffix("suffix", "fix") // trueplay.golang.org
https://stackoverflow.com/questions/13244048
复制相似问题