From: Georg Bauhaus <sb463ba@l1-hrz.uni-duisburg.de>
Subject: Re: questions from a newbie
Date: Thu, 15 Jul 2004 14:44:39 +0000 (UTC)
Date: 2004-07-15T14:44:39+00:00 [thread overview]
Message-ID: <cd658n$cej$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: 40f684a8@dnews.tpgi.com.au
zork <zork@nospam.com> wrote:
:
: if c in 'A'..'Z' or c in 'a'..'z' or c in '0'..'9' then
:
:
: if c in ('A'..'Z', 'a'..'z', '0'..'9') then
This is the purpose of Ada.Strings.Maps etc.
In Ada.Strings.Maps.Constants you will find predefined
Character_Set constant that match yours.
: Also, I know you can do the following:
:
: type new_type is array(1..20) of string(1..50);
: words : new_type;
: index : integer := 20;
: words (15) (index ..index) := "K";
:
: however I find that I cannot instead say:
:
: words(15)(index):="K";
:
: why is this so?
...(index) denotes a Character, one component of an array,
...(index .. index) denotes an array slice.
The index values can in general be results of computations at
runtime, i.e., ...(n .. m). What kind of thing other than
an array slice should (n .. m) denote? OTOH, ...(n) where n
is an index value cannot but denote one array component.
: I get a "Type mismatch in assignment statement, continuing"
: error. It does however work when I use words(15)(index):='K'. The rational
: behind this is that (index..index) represents a range - hence a string -
: whereas (index) represents a single character?
next prev parent reply other threads:[~2004-07-15 14:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-07-15 13:20 questions from a newbie zork
2004-07-15 13:35 ` Marius Amado Alves
2004-07-15 13:45 ` Steve
2004-07-15 14:44 ` Georg Bauhaus [this message]
2004-07-15 15:09 ` Jacob Sparre Andersen
2004-07-15 15:52 ` zork
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox