Post

GoLangGoLang

christina joce

Posted on 25th November 2022|3044 views

0
votes

Byte To Int Golang

How to convert the byte to int in golang?

Answers
P
ravi sankar

Posted on 25th November 2022

Here is an example:

package main

import (

"fmt"

)

func main() {

aByte := byte(148)

asInt := int(aByte)

fmt.Println(asInt)  

aString := "x"

asInt2 := int(aString[0])

      fmt.Println(asInt2)

newString := string(aString[0] + 1)

fmt.Println(newString)

}

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo
  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos