Results 1 to 3 of 3

Thread: Need to convert string to ascii values with C#

  1. #1
    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.

  2. #2
    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();

  3. #3
    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!

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,254,227.56910 seconds with 17 queries