Coronavirus Outbreak - 2020, 100+ dead in China, effected several countries, Checkout WHO Advices to stay safe

Kotlin Program to Convert ASCII Code to Character

Greetings!
We have recently published 100+ articles on android tutorials with kotlin and java. If you need, you may visit Android Tutorial for beginners page. You can also check Kotlin Tutorial for beginners. Also, if you are interested in content writing, you can mail us at tutorialwing@gmail.com.

In this post, we will learn about how to convert ASCII Code to Character in Kotlin programming language.

Kotlin Program to Convert ASCII Code to Character

We use toChar() function to convert any value to character. So, we will use this function in our example.

Sourcecode –

package tutorial

fun main() {

    val asciiValue = 97

    // Get ASCII value of exampleChar
    val charValue = asciiValue.toChar()

    println("Character value of $asciiValue is $charValue")
}

When you run the program, output will be

Character value of 97 is a
Explanation:

In this example, we have taken 97 as ASCII value. We stored this value in variable asciiValue

Then, We get it’s character value using toChar() method and stored it in another variable charValue.

Finally, we print result using println() function.

Support Us

If you like Tutorialwing and would like to contribute, you can email an article on any educational topic at tutorialwing@gmail.com. We would love to publish your article. See your article on Tutorialwing and help others with your knowledge. Follow Facebook, LinkedIn, Google+, Twitter, Youtube for latest updates.
Greetings!
We have recently published 100+ articles on android tutorials with kotlin and java. If you need, you may visit Android Tutorial for beginners page. You can also check Kotlin Tutorial for beginners

Leave a Reply