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
+40.5k Golang : Convert to io.ReadSeeker type
+12.5k Golang : Forwarding a local port to a remote server example
+41.2k Golang : How to count duplicate items in slice/array?
+7.1k Javascript : How to get JSON data from another website with JQuery or Ajax ?
+19.4k Golang : How to count the number of repeated characters in a string?
+10.1k Golang : Identifying Golang HTTP client request
+28.6k Get file path of temporary file in Go
+14k Golang : Reverse IP address for reverse DNS lookup example
+20.9k Golang : Underscore or snake_case to camel case example
+8.8k Golang : Heap sort example
+28.5k Golang : Change a file last modified date and time
+14.4k Golang : Parsing or breaking down URL