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
+6.3k Apt-get to install and uninstall Golang
+6.5k Unix/Linux : How to get own IP address ?
+14.3k Golang : Get uploaded file name or access uploaded files
+22.7k Golang : Set and Get HTTP request headers example
+3.6k Java : Get FX sentiment from website example
+6.1k Golang : Create new color from command line parameters
+48.1k Golang : How to convert JSON string to map and slice
+22.2k Golang : Print leading(padding) zero or spaces in fmt.Printf?
+15.2k Golang : How to check if IP address is in range
+15.3k Golang : Delete certain files in a directory
+11.6k Swift : Convert (cast) Float to String
+6.5k Golang : Combine slices of complex numbers and operation example