Solved

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

Posted on 2011-02-25
9
596 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 
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
 
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

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

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…
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 …
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

691 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