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.1k Swift : Convert (cast) Float to Int or Int32 value
+9.5k Golang : Extract or copy items from map based on value
+44.9k Golang : Use wildcard patterns with filepath.Glob() example
+9.7k Golang : Populate slice with sequential integers example
+13.5k Golang : Count number of runes in string
+5.7k Fix yum-complete-transaction error
+9.3k Golang : How to get username from email address
+5.6k Python : Print unicode escape characters and string
+24.5k Golang : Change file read or write permission example
+11.7k Golang : Find age or leap age from date of birth example
+11.3k Golang : How to flush a channel before the end of program?
+7.9k Golang : Ways to recover memory during run time.