strings.EqualFold() Function in Golang With Examples
Last Updated :
09 Jun, 2022
strings.EqualFold() Function in Golang reports whether s and t, interpreted as UTF-8 strings, are equal under Unicode case-folding, which is a more general form of case-insensitivity.
Syntax:
func EqualFold(s1, s2 string) bool
Here, s1 and s2 are strings.
Return Value: It returns the boolean value.
Example 1:
Go
package main
import ( "fmt"
"strings" )
func main()
{
fmt.Println(strings.EqualFold( "Geeks" , "Geeks" ))
fmt.Println(strings.EqualFold( "computerscience" ,
"computerscience" ))
}
|
Output:
true
true
Example 2:
Go
package main
import ( "fmt"
"strings" )
func main()
{
fmt.Println(strings.EqualFold( "Geeks" , "geeks" ))
fmt.Println(strings.EqualFold( "COMPUTERSCIENCE" ,
"computerscience" ))
}
|
Output:
true
true
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...