Skip to content

Dwain Maralack

Learning and Writing

  • About
  • Personal Development
  • Software Engineering
  • Business

Tag: bytes

How many bytes are emoji characters in GO?

It takes 4 bytes for each emoji character and 1 byte for every ASCII character.

package main

import (
	"fmt"
)

func main() {
	a := []byte("😂")
	fmt.Println(len(a))
	// prints 4

	b := []byte("H")
	fmt.Println(len(b))
	// prints 1

}

Dwain Maralack Software Engineering 2 Comments January 17, 2020 1 Minute
Blog at WordPress.com.