convert letters

  • Thread starter Thread starter Trond Hoiberg
  • Start date Start date
T

Trond Hoiberg

I was wondering if someone in here knows if it is possible to convert a
letter (a, b, c....) to the ISO Latin-1 Character Set Decimal code?
a= a
b=b
c=c
I know it is possible but i was looking for a way to do it by using the
Framework. Some utility that returns the Decimal code from the mentioned
Character Set if input is a character like 1, 2..a, b ... and so on.

Best regards
Trond
 
The reason why i asked is that Browsers can understand a and "convert"
it to a. Most of us has used   wich is also from ISO Latin-1 Character
Set.
If you type in a in help in vs2003 you get the entire table.
Best regards
Trond
 
ASCIIEncoding c = new ASCIIEncoding();
byte [] x = c.GetBytes("Hello World");
Encoding.Convert(Encoding.Default, Encoding.GetEncoding("Windows-1252"), x,
0, 1);

foreach(byte s in x)
{
MessageBox.Show(s.ToString());
}
 
Trond Hoiberg said:
I was wondering if someone in here knows if it is possible to convert a
letter (a, b, c....) to the ISO Latin-1 Character Set Decimal code?
a= a
b=b
c=c
I know it is possible but i was looking for a way to do it by using the
Framework. Some utility that returns the Decimal code from the mentioned
Character Set if input is a character like 1, 2..a, b ... and so on.

The first 256 values of Unicode *are* ISO Latin 1, so you just need to
convert from char to int - which is a widening conversion, and so done
implicitly. For instance:

int a = 'A'; // a is now 65.
 
Back
Top