Golang encoding/hex.EncodedLen() function example
package encoding/hex
EncodedLen returns the length of an encoding of n source bytes.
Golang encoding/hex.EncodedLen() function usage example
package main
import (
"encoding/hex"
"fmt"
)
func main() {
str := "abcd"
fmt.Printf("Len size is : %v \n", len(str))
fmt.Printf("EncodedLen(count number of bytes) size is : %v \n", hex.EncodedLen(len(str)))
}
Output :
Len size is : 4
EncodedLen(count number of bytes) size is : 8
Reference :
Advertisement
Something interesting
Tutorials
+5.9k Golang : Use NLP to get sentences for each paragraph example
+15.4k Golang : Find location by IP address and display with Google Map
+8.3k Useful methods to access blocked websites
+12.6k Golang : Transform comma separated string to slice example
+5.4k Golang : Return multiple values from function
+9.6k Golang : Copy map(hash table) example
+14k Golang: Pad right or print ending(suffix) zero or spaces in fmt.Printf example
+33.7k Golang : All update packages with go get command
+8k Findstr command the Grep equivalent for Windows
+5.4k Golang : Qt update UI elements with core.QCoreApplication_ProcessEvents
+19.9k Golang : Count JSON objects and convert to slice/array
+6k Golang : Compound interest over time example