Solved

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

Posted on 2011-02-25
9
590 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
ID: 34978766
Did you try the following

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

Expert Comment

by:John Claes
ID: 34978809
I propose

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

Expert Comment

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

Expert Comment

by:TinTombStone
ID: 34978849
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 13

Expert Comment

by:Naman Goel
ID: 34978857
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
ID: 34979016
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
ID: 34979049
0
 
LVL 39

Expert Comment

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

Expert Comment

by:Dhaest
ID: 34979157
Whate .net version are you using ?
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

863 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

24 Experts available now in Live!

Get 1:1 Help Now