devxlogo

ASCII Value Conversions

ASCII Value Conversions

Question:
How can I convert an integer ascii representationof a number to its character equivalent in astring form. For example

A= 72 

What procedure will take in int 72 and returnstring “A”

Answer:
The simplest way to accomplish this is totypecast the int to a char and convert thatchar to a String. You have several choiceswhen it comes to converting a char toa string, but perhaps the simplest way toaccomplish what you want is:

int a = 72;Character aChar;String aString;aChar = new Character((char)a);aString = aChar.toString();
See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist