comp.lang.ada
 help / color / mirror / Atom feed
From: Lao Xiao Hai <laoxhai@ix.netcom.com>
Subject: Re: Ascii keyword??
Date: Fri, 16 Feb 2001 20:51:02 -0800
Date: 2001-02-17T04:52:26+00:00	[thread overview]
Message-ID: <3A8E0336.FE82B6FC@ix.netcom.com> (raw)
In-Reply-To: 96kcm8$gcq$1@hobbes2.crc.com



"David C. Hoos, Sr." wrote:

> What you need is the language-defined function
> Character'Val (<integer_expression>) to convert
> a number in the range 0 .. 255 to its corresponding
> character, and the language-defined function
> Character'Pos (<character_value>) to obtain its
> position in the character set -- 0 .. 255;
>
> E.g., Character'Val (65) returns 'A', and
> Character'Pos ('A') returns 65.
>

David,

I made the assumption he needed to convert ascii strings to numbers.  That
might have been incorrect.   Often, when teaching Ada, I find that this kind
of question, when posed by someone from a C/C++ background, is not really
about the one-to-one correspondence between the character name and the
numeric ASCII value, but rather about making numbers from strings and
vice-versa.






      parent reply	other threads:[~2001-02-17  4:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-02-16 18:34 Ascii keyword?? Richard
2001-02-16 18:46 ` Pascal Obry
2001-02-16 18:52 ` Marin David Condic
2001-02-16 19:29 ` Lao Xiao Hai
2001-02-16 23:22 ` David C. Hoos, Sr.
2001-02-17  0:54   ` Jeffrey Carter
2001-02-17  4:51   ` Lao Xiao Hai [this message]
replies disabled

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