How to compare two strings ignoring case in Go

1 Answer

0 votes
package main

import (
	"fmt"
	"strings"
)

func main() {
	s1 := "go language"
	s2 := "GO LANGUAGE"
	
	// func EqualFold(s, t string) bool // case-insensitivity compare 
	
	fmt.Println(strings.EqualFold(s1, s2))
}



/*
run:

true

*/

 



answered May 22, 2024 by avibootz

Related questions

1 answer 140 views
1 answer 132 views
2 answers 154 views
1 answer 142 views
142 views asked Aug 23, 2024 by avibootz
1 answer 130 views
1 answer 116 views
2 answers 202 views
...