comp.lang.ada
 help / color / mirror / Atom feed
From: Wes Groleau <wgroleau@usa.com>
Subject: Re: Characters and Numerics
Date: Wed, 05 Dec 2001 13:55:13 -0500
Date: 2001-12-05T13:55:13-05:00	[thread overview]
Message-ID: <3C0E6D91.43FEE78F@usa.com> (raw)
In-Reply-To: u0sd9lh6m11lc0@corp.supernews.com



Matthew Heaney wrote:
> 
> "M. A. Alves" <maa@liacc.up.pt> wrote in message
> news:mailman.1007554622.31106.comp.lang.ada@ada.eu.org...
> > On 5 Dec 2001, Duke Luke wrote:
> > > How can I change type character to type natural??
> > > e.g: '3' -> 3;
> >
> > Use attribute Value of the type Natural upon a String version of
> > the Character e.g.
> >
> >   N := Natural'Value(C & "");
> 
> Or just
> 
>    N := Character'Pos (C) - Character'Pos ('0');

If C = 'Z' the former will raise constraint error;
the latter will assign N a large number.


-- 
Wes Groleau
http://freepages.rootsweb.com/~wgroleau



  reply	other threads:[~2001-12-05 18:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-05 12:03 Characters and Numerics Duke Luke
2001-12-05 12:07 ` Lutz Donnerhacke
2001-12-05 12:16 ` M. A. Alves
2001-12-05 14:58   ` Matthew Heaney
2001-12-05 18:55     ` Wes Groleau [this message]
2001-12-05 19:24       ` Matthew Heaney
2001-12-05 21:27         ` Wes Groleau
2001-12-06  0:19     ` tmoran
replies disabled

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