From: tmoran@acm.org
Subject: Re: Arrays and Access types...
Date: Fri, 26 Oct 2001 06:14:29 GMT
Date: 2001-10-26T06:14:29+00:00 [thread overview]
Message-ID: <9b7C7.72630$gT6.36973495@news1.rdc1.sfba.home.com> (raw)
In-Reply-To: 20011025214647.2788a60b.egm2@jps.net
>left, right, start : My_Array_Ref;
> ...
> left := start(start'first .. 100); -- that doesn't work!
"left" is not an array, so you can't assign an array to it - it's an
access type. I presume you don't want to create a new string with an
initial value that is a copy of start(start'first .. 100), but you want
"left" to rename the leftmost part of "start", and you would prefer to
do this without access values.
start : string(1 .. 200); -- or whatever
first_blank:natural;
left : string renames start(start'first .. 100);
begin
first_blank := ada.strings.fixed.index(left, " "); -- assume > 1
declare
leftmost_word : string renames left(left'first .. first_blank-1);
begin
...
If you need to divide it into N substrings, where N is not known at
compile time, you'll want a loop or a recursive procedure, of course.
next prev parent reply other threads:[~2001-10-26 6:14 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-26 4:46 Arrays and Access types Eric G. Miller
2001-10-26 5:39 ` James Rogers
2001-10-26 6:45 ` Eric G. Miller
2001-10-26 16:40 ` James Rogers
2001-10-26 6:14 ` tmoran [this message]
2001-10-26 14:26 ` Ted Dennison
2001-10-26 19:31 ` chris.danx
2001-10-26 23:32 ` Jeffrey Carter
2001-10-27 1:08 ` Eric G. Miller
2001-10-27 2:09 ` DuckE
2001-10-27 4:23 ` Steven Deller
2001-10-27 18:30 ` Eric G. Miller
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox