comp.lang.ada
 help / color / mirror / Atom feed
From: Dmitry A. Kazakov <mailbox@dmitry-kazakov.de>
Subject: Re: types and non-contigous ranges
Date: Thu, 26 Feb 2004 17:07:12 +0100
Date: 2004-02-26T17:07:12+01:00	[thread overview]
Message-ID: <vg5s30h8fihtrvc0k5kqu2nnhuc7u09nar@4ax.com> (raw)
In-Reply-To: 403e001b$0$144$edfadb0f@dread11.news.tele.dk

On Thu, 26 Feb 2004 15:17:38 +0100, Erlo Haugen <_elh_@_tema_._com_>
wrote:

>Hello everyone,
>what is the easiest way to define a (sub)type consisting of ranges and 
>single values?

Only ranges are allowed.

>Let me give an example:
>
>I want a type, based on character, that contains 'A'..'Z' and '0'..'9'
>and some single characters like '�','�' and '�'.
>
>subtype Valid_Characters is character range 'A'..'Z' ????? and what then??
>
>
>Do I really have list all the values?

Take a look at Ada.Strings.Maps and Strings.Maps.Constants. They
provide sets of characters, operations on them and useful constant
sets like Alphanumeric_Set etc. I think that

Whatsoever : constant Character_Set :=
   Decimal_Digit_Set  or
   To_Set (Character_Range'('A', 'Z')) or
   To_Set ('�') or
   To_Set ('�') or
   To_Set ('�');

is what you are looking for.

--
Regards,
Dmitry A. Kazakov
www.dmitry-kazakov.de



  parent reply	other threads:[~2004-02-26 16:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-26 14:17 types and non-contigous ranges Erlo Haugen
2004-02-26 15:52 ` Jacob Sparre Andersen
2004-02-27  7:55   ` Erlo Haugen
2004-02-27 13:00     ` Jacob Sparre Andersen
2004-02-27 13:21       ` Erlo Haugen
2004-02-27 13:58         ` Character encoding (Was: types and non-contigous ranges) Jacob Sparre Andersen
2004-02-26 16:07 ` Dmitry A. Kazakov [this message]
2004-02-27  7:53   ` types and non-contigous ranges Erlo Haugen
2004-02-27 23:59     ` Randy Brukardt
2004-03-01  8:50       ` Erlo Haugen
replies disabled

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