comp.lang.ada
 help / color / mirror / Atom feed
From: dmarshal@netcom.com (Dave Marshall)
Subject: Re: help: character to integer
Date: 1996/10/02
Date: 1996-10-02T00:00:00+00:00	[thread overview]
Message-ID: <dmarshalDyMJqo.829@netcom.com> (raw)
In-Reply-To: 52s2pl$18l@dailyplanet.wam.umd.edu


spear@wam.umd.edu (Eric Anthony Spear) writes:

>I've tried to find the answer in the RM, but I haven't had any luck.

>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.

>Thanks in advance for any help.

RM83:

3.5.5(6): [Operations of Discrete Types]

T'POS	This attribute is a function.  The parameter X must be a value
of the base type of T.  The result type is the type universal integer.
The result is the position number of the value of the parameter.

So,

My_Integer := Character'Pos('X') -- 16#58#

The corresponding RM95 discussion begins at 3.5.5(2) and even includes
a handy function specification.

-- 
Dave Marshall
dmarshal@netcom.com





  parent 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 ` Richard A. O'Keefe
1996-10-02  0:00   ` George Haddad
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-02  0:00 ` Dave Marshall [this message]
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