comp.lang.ada
 help / color / mirror / Atom feed
From: ok@goanna.cs.rmit.edu.au (Richard A. O'Keefe)
Subject: Re: help: character to integer
Date: 1996/10/02
Date: 1996-10-02T00:00:00+00:00	[thread overview]
Message-ID: <52t8la$2l8@goanna.cs.rmit.edu.au> (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.

It's there.

>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');

-- 
Australian citizen since 14 August 1996.  *Now* I can vote the xxxs out!
Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.




  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 [this message]
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 ` help: character to integer Dave Marshall
1996-10-07  0:00 ` 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