String Go中不区分大小写的字符串比较

String Go中不区分大小写的字符串比较,string,go,string-comparison,equality,case-insensitive,String,Go,String Comparison,Equality,Case Insensitive,如何以不区分大小写的方式比较字符串 例如,“Go”和“Go”应该被认为是相等的。是您正在寻找的函数。它的用法如下(链接文档中的示例): 除了字符串.EqualFold之外,还有字节.EqualFold以同样的方式工作 EqualFold not compare:(排序可以使用strings.ToLower(“Go”)EqualFold not compare@lunicon什么意思?@KBN,compare操作可以说“more,less或equals”,EqualFold retrun boo

如何以不区分大小写的方式比较字符串

例如,“Go”和“Go”应该被认为是相等的。

是您正在寻找的函数。它的用法如下(链接文档中的示例):


除了
字符串.EqualFold
之外,还有
字节.EqualFold
以同样的方式工作


EqualFold not compare:(排序可以使用strings.ToLower(“Go”)EqualFold not compare@lunicon什么意思?@KBN,compare操作可以说“more,less或equals”,EqualFold retrun boolean
package main

import (
    "fmt"
    "strings"
)

func main() {
    fmt.Println(strings.EqualFold("Go", "go"))
}