From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: *** X-Spam-Status: No, score=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,60973b026c6e423d X-Google-Attributes: gid103376,public From: "David C. Hoos, Sr." Subject: Re: help: character to integer Date: 1996/10/02 Message-ID: <01bbb0b6$adc62100$388371a5@dhoossr.iquest.com>#1/1 X-Deja-AN: 186795877 distribution: world references: <52s2pl$18l@dailyplanet.wam.umd.edu> <52t8la$2l8@goanna.cs.rmit.edu.au> <3252BEC8.529E@lmco.com> content-type: text/plain; charset=ISO-8859-1 organization: DBH Enterprises, Inc. mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-10-02T00:00:00+00:00 List-Id: George Haddad wrote in article <3252BEC8.529E@lmco.com>... > 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 Yes, there is a guarantee -- it's called the ANSI/ISO/IEC-8652:1995 Ada 95 Reference Manual, A.3.3, declaration for the package Ada.Characters.Latin_1. The values Character'Val(0) .. Character'Val(127) are the 7-bit ASCII character set of olden days, and the Latin_1 set includes the values Character'Val(0) .. Character'Val (255). -- David C. Hoos, Sr., http://www.dbhwww.com http://www.ada95.com