Golang bytes.EqualFold() function example
package bytes
EqualFold reports whether the given inputs, interpreted as UTF-8 strings, are equal under Unicode case-folding.
Golang bytes.EqualFold() function usage example
package main
import (
"bytes"
"fmt"
)
func main() {
slice1 := []byte("世界")
slice2 := []byte("xyz")
slice3 := []byte("世界")
fmt.Println(bytes.EqualFold(slice1, slice2))
fmt.Println(bytes.EqualFold(slice1, slice3))
fmt.Println(bytes.EqualFold(slice2,[]byte("XYZ"))) // big cap and small cap
}
Output :
false
true
true
Reference :
Advertisement
Something interesting
Tutorials
+17.9k Golang : Qt image viewer example
+21.1k Golang : Convert(cast) string to rune and back to string example
+28.6k Golang : Read, Write(Create) and Delete Cookie example
+6.9k Golang : Fibonacci number generator examples
+7.3k Golang : Of hash table and hash map
+9.4k Golang : Detect Pascal, Kebab, Screaming Snake and Camel cases
+7.5k Golang : How to stop user from directly running an executable file?
+18.2k Golang : Put UTF8 text on OpenCV video capture image frame
+17k Golang : Get input from keyboard
+9.3k Golang : How to protect your source code from client, hosting company or hacker?
+39.6k Golang : Remove dashes(or any character) from string
+5.3k Golang : Get FX sentiment from website example