2021
02-21
02-21
golang 字符串比较是否相等的方法示例
golang字符串比较的三种常见方法fmt.Println("go"=="go")fmt.Println("GO"=="go")fmt.Println(strings.Compare("GO","go"))fmt.Println(strings.Compare("go","go"))fmt.Println(strings.EqualFold("GO","go"))输出truefalse-10true1,自建方法“==”,区分大小写,最简单的方法2,Compare函数,区分大小写,自建方法“==”的速度要比Compare快,下面是注释/Compareisincludedonlyforsymmetrywithpackagebytes.//Itis...
继续阅读 >