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
 
As I recall, the character codes are composed of hex values.

search: ascii to hex c#
search: ascii to hex vb.net

There are a lot of documents showing the many techniques and variations and
there may be a unique class that can be used.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/
 
The reason why i asked is that Browsers can understand a and "convert"
it to a. Most of us has used &nbsp; 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top