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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID 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: dmarshal@netcom.com (Dave Marshall) Subject: Re: help: character to integer Date: 1996/10/02 Message-ID: #1/1 X-Deja-AN: 186587575 sender: dmarshal@netcom19.netcom.com references: <52s2pl$18l@dailyplanet.wam.umd.edu> organization: NETCOM On-line Communication Services (408 261-4700 guest) newsgroups: comp.lang.ada Date: 1996-10-02T00:00:00+00:00 List-Id: 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