How to get the ASCII value of a string

Suppose there is a string:

String str="Hello";

HOw can i get the ASCII value of that above mentioned string?

Jon Skeet
people
quotationmark

Given your comment, it sounds like all you need is:

char[] chars = str.ToCharArray();
Array.Sort(chars);

A char value in .NET is actually a UTF-16 code unit, but for all ASCII characters, the UTF-16 code unit value is the same as the ASCII value anyway.

You can create a new string from the array like this:

string sortedText = new string(chars);
Console.WriteLine(chars);

As it happens, "Hello" is already in ascending ASCII order...

people

See more on this question at Stackoverflow