Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

strings.EqualFold() Function in Golang With Examples

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

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




// Golang program to illustrate the
// strings.EqualFold() Function
package main
 
    // importing fmt and strings
    import("fmt"
           "strings")
 
    // calling main method
    func main()
{
    // case insensitive comparing and returns true.
    fmt.Println(strings.EqualFold("Geeks", "Geeks"))
 
        // case insensitive comparing and returns true.
        fmt.Println(strings.EqualFold("computerscience",
                                      "computerscience"))
}

Output:

true
true

Example 2: 

Go




// Golang program to illustrate the
// strings.EqualFold() Function
 
package main
 
    // importing fmt and strings
    import("fmt"
           "strings")
 
    // calling main method
    func main()
{
 
    // case insensitive comparing and returns true.
    fmt.Println(strings.EqualFold("Geeks", "geeks"))
 
        // case insensitive comparing and returns true.
        fmt.Println(strings.EqualFold("COMPUTERSCIENCE",
                                      "computerscience"))
}

Output:

true
true

My Personal Notes arrow_drop_up
Last Updated : 09 Jun, 2022
Like Article
Save Article
Similar Reads