Post

GoLangGoLang

christina joce

Posted on 24th April 2024|7245 views

0
votes

Byte To Int Golang

How to convert the byte to int in golang?

Answers
P
ravi sankar

Posted on 24th April 2024

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