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
+15.2k Golang : Get timezone offset from date or timestamp
+8.6k Golang : Set or add headers for many or different handlers
+7.5k Golang : Create zip/ePub file without compression(use Store algorithm)
+13.8k Generate salted password with OpenSSL example
+14.5k Golang : How to check if your program is running in a terminal
+13.5k Golang : How to get year, month and day?
+31.1k Golang : Calculate percentage change of two values
+3.6k Java : Get FX sentiment from website example
+12.7k Golang : Remove or trim extra comma from CSV
+5.1k Swift : Convert (cast) Float to Int or Int32 value
+11k Golang : Create Temporary File
+24k Golang : Find biggest/largest number in array