comp.lang.ada
 help / color / mirror / Atom feed
From: George Haddad <george.haddad@lmco.com>
Subject: Re: help: character to integer
Date: 1996/10/02
Date: 1996-10-02T00:00:00+00:00	[thread overview]
Message-ID: <3252BEC8.529E@lmco.com> (raw)
In-Reply-To: 52t8la$2l8@goanna.cs.rmit.edu.au


Richard A. O'Keefe wrote:
> spear@wam.umd.edu (Eric Anthony Spear) writes:
> >Is there a function, either in a package or as an attribute, that can 
> >work like this BASIC function:

> >i = ASC("X")
 
> >That is, the function returns the ASCII value of the given character.
> 
> Values of any discrete type can be converted to integers using the
> 'Pos attribute and back again using the 'Val attribute.  This was so
> in Ada 83 and is still so in Ada 95.   You want
> 
>         I := Character'Pos('X');

   Forgive my ignorance, but is there any guarantee that 
Character'POS('X') = {ASCII code for 'X'}?  Especially now that Ada uses 
ISO Latin-1 (or whatever the standard actually calls for).  Are ASCII 
and Latin-1 two names for the same standard?  (I assume that they are at 
least equivalent for "well-behaved" characters as the solution probably 
works empirically.)

   That having been said, it would obviously be easy to convert between 
the two by providing a lookup table.
-- 
I found these opinions on my doorstep, would you please give them a good 
home?




  reply	other threads:[~1996-10-02  0:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-10-01  0:00 help: character to integer Eric Anthony Spear
1996-10-02  0:00 ` Dave Marshall
1996-10-02  0:00 ` Richard A. O'Keefe
1996-10-02  0:00   ` George Haddad [this message]
1996-10-02  0:00     ` David C. Hoos, Sr.
1996-10-02  0:00     ` Robert A Duff
1996-10-05  0:00     ` Robert Dewar
1996-10-07  0:00       ` the term "pound sign" (was: help: character to integer) Adam Beneschan
1996-10-09  0:00         ` Michael Feldman
1996-10-09  0:00           ` Robert Dewar
1996-10-09  0:00             ` Michael Feldman
1996-10-10  0:00             ` Richard Kenner
1996-10-10  0:00               ` Adam Beneschan
1996-10-11  0:00           ` Robert I. Eachus
1996-10-11  0:00             ` Robert Dewar
1996-10-07  0:00 ` help: character to integer Paul Tongue
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox