Home > DeveloperSection > Forums > How to get ascii values of chars in c#?
Brad Pitt
Brad Pitt

Total Post:61

Points:429
Posted on    October-05-2014 11:57 PM

 C# ASP.Net  C# 
Ratings:


 1 Reply(s)
 784  View(s)
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#.




Kamlakar Singh
Kamlakar Singh

Total Post:194

Points:1396
Posted on    October-05-2014 11:58 PM

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

        }

    }

}


Don't want to miss updates? Please click the below button!

Follow MindStick