Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Need to convert string to ascii values with C#

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 02-02-2009
Member
 
Join Date: Jan 2009
Posts: 18
Need to convert string to ascii values with C#
  

Hi,
In a C# program I need to convert the string to its ascii values.
using System.Convert.ToInt32(C) where c is sub string of main string gives me an error message says string input format incorrect.
Please help me to convert char value to ASCII number.

Reply With Quote
  #2  
Old 02-02-2009
Member
 
Join Date: Jan 2009
Posts: 19
Re: Need to convert string to ascii values with C#

Can you please try this?

Try this
string s = "Welcome";
foreach( char c in s)
{
Console.WriteLine(System.Convert.ToInt32(c));
}
Console.ReadLine();
Reply With Quote
  #3  
Old 02-02-2009
Member
 
Join Date: May 2008
Posts: 63
Re: Need to convert string to ascii values with C#

What you guys think about (int)cSomeChar?

I hope this works!
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Need to convert string to ascii values with C#"
Thread Thread Starter Forum Replies Last Post
Converting Boolean values to string in Java 27lynx27 Software Development 1 13-02-2011 03:40 AM
Problem in creating array from string values Cedric Software Development 4 19-01-2010 05:48 PM
Convert ebcdic file to ASCII L-cynthiya Software Development 3 30-11-2009 05:09 PM
How to convert Image To HTML Files With ASCII Characters Francesca Software Development 2 26-03-2009 11:26 PM
How to convert a character to ASCII in C++? RupaliP Software Development 2 18-02-2009 12:03 AM


All times are GMT +5.5. The time now is 12:58 PM.