golang中字符串操做函数strings.Comparehtml
package main import ( "fmt" "strings" ) //golang字符串操做 func main(){ s := "Hello world hello world" str := "Hello" //var s = []string{"11","22","33"} //比较字符串,区分大小写,比”==”速度快。相等为0,不相等为-1。 ret := strings.Compare(s,str) fmt.Println(ret) // 1 }