HOW TO GET ASCII VALUES OF CHARS IN C#?

Brad Pitt

Total Post:61

Points:429
Posted by  Brad Pitt
ASP.Net  C# 
C#
 1075  View(s)
Ratings:
Rate this:
I am accustom to coding in java, but recently i have been making some asp webpages that use c#. in Java chars are default represented by their numeric ascii value unless you put them with a string. I have been unable to repeat this in c#. what do i need to do to get ascii values of chars in c#.


  1. Kamlakar Singh

    Post:194

    Points:1396
    Re: How to get ascii values of chars in c#?

    try this code:

    public static IEnumerable<int> Utf32CodePoints(string s, int index)

    {

        for (int length = s.Length; index < length; index++)

        {

            yield return char.ConvertToUtf32(s, index);

            if (char.IsSurrogatePair(s, index))

                   index++;

            }

        }

    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!