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
+17.9k Golang : How to make a file read only and set it to writable again?
+7.1k Nginx : How to block user agent ?
+4.7k Golang : How to pass data between controllers with JSON Web Token
+10k Golang : Read file and convert content to string
+4.3k Golang : Converting individual Jawi alphabet to Rumi(Romanized) alphabet example
+9.2k Golang : does not implement flag.Value (missing Set method)
+8.1k Golang : Get all countries phone codes
+8.6k Golang : Progress bar with ∎ character
+22.1k Golang : Match strings by wildcard patterns with filepath.Match() function
+10k Golang : Get escape characters \u form from unicode characters
+12.4k Elastic Search : Return all records (higher than default 10)
+5.3k Python : Convert(cast) string to bytes example