Solved

how can i convert ascii value to character and then storing it to string ??

Posted on 2011-02-25
9
586 Views
Last Modified: 2012-05-11
i want to know that how can i convert ascii value to character and then storing it to string ??

for ex ..

int i = 97 then

string str = "a"

but how can i do this ??
0
Comment
Question by:Parth48
9 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 500 total points
Comment Utility
Did you try the following

int i = 97;
string str = char.ConvertFromUtf32(i);
0
 
LVL 10

Expert Comment

by:John Claes
Comment Utility
I propose

int i = 97;
string str = Convert.ToChar(i);
0
 
LVL 39

Expert Comment

by:Pratima Pharande
Comment Utility
int i = 97
string str = Convert.ToChar(i).ToString() ;
0
 
LVL 6

Expert Comment

by:TinTombStone
Comment Utility
I think convertFromUtf32() is the best option.

    class Program
    {
        static void Main(string[] args)
        {
            int i = 97;
            string ch = char.ConvertFromUtf32(i);
            Console.WriteLine(ch);
        }
    }
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 13

Expert Comment

by:Naman Goel
Comment Utility
use following method for this :

static String ConvertAsciiToString(int number)
        {
            string stringValue = char.ConvertFromUtf32(number).ToString();
            return stringValue;
        }

or 

static String ConvertAsciiToString(int number)
        {
            string stringValue = new string((char)number, 1);
            return stringValue;
        }

Open in new window

0
 
LVL 39

Expert Comment

by:Pratima Pharande
Comment Utility
hey I tried Dhaest that solution giving error

'char' does not contain a definition for 'ConvertFromUtf32'

is it working for you ?

int i = 97;
string str = char.ConvertFromUtf32(i);
0
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
0
 
LVL 39

Expert Comment

by:Pratima Pharande
Comment Utility
ok Dheast . might be it is becae I am using old .net version
0
 
LVL 53

Expert Comment

by:Dhaest
Comment Utility
Whate .net version are you using ?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Windows Service to Receive TCP Packets 4 30
Set form below another form 3 25
Showdialog 8 20
fomat Json objects 6 15
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now