Welcome To Golang By Example

Menu
  • Home
  • Blog
Menu

ASCII digit to the character in Go (Golang)

Posted on February 20, 2023February 20, 2023 by admin

Table of Contents

  • Overview
  • Program

Overview

Below is the simple program to convert an ASCII digit to its corresponding character in go. We can simply typecast the number to the string. That will convert it into its corresponding ASCII character

Program

package main
import "fmt"
func main() {
sampleASCIIDigits := []int{97, 98, 99}
for _, digit := range sampleASCIIDigits {
fmt.Printf("Char %s\n", string(digit))
}
}

Output

Char a
Char b
Char c
  • go
  • golang
  • Popular Articles

    Golang Comprehensive Tutorial Series

    All Design Patterns in Go (Golang)

    Slice in golang

    Variables in Go (Golang) – Complete Guide

    OOP: Inheritance in GOLANG complete guide

    Using Context Package in GO (Golang) – Complete Guide

    All data types in Golang with examples

    Understanding time and date in Go (Golang) – Complete Guide

    ©2023 Welcome To Golang By Example | Design: Web XP