comp.lang.ada
 help / color / mirror / Atom feed
From: jsa@alexandria (Jon S Anthony)
Subject: Re: [Q] Returning Strings From A Function
Date: 1997/04/07
Date: 1997-04-07T00:00:00+00:00	[thread overview]
Message-ID: <JSA.97Apr7160651@alexandria> (raw)
In-Reply-To: 33474626.4BA3@us.net


In article <19970407112901.HAA07881@ladder01.news.aol.com> johnherro@aol.com writes:

> I wrote:
> >>    Target(1 .. Source'Length) := Source;
> 
> Mark & Zurima McKinney <mckmark@us.net> wrote:
> > maybe Target(Target'First .. Target'First + Source'Length -1);
> 
> Absolutely!  I've often warned my students not to assume that the
> index of a string starts at 1, and even have that warning in my Ada
> Tutor program.  Then in my haste I made that error myself in the
> above posting!

IMO, the simplest way of getting at the (Target'First .. Target'First
+ Source'Length -1 business is to write:

    Target(Source'Range) := Source;

Of course this may not be what you are after since the slice
represented here may not be the one you really want...

/Jon

-- 
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com





  reply	other threads:[~1997-04-07  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-04-04  0:00 [Q] Returning Strings From A Function John McCabe
1997-04-04  0:00 ` Joakim Olsson
1997-04-05  0:00 ` johnherro
1997-04-05  0:00   ` Mark & Zurima McKinney
1997-04-07  0:00     ` Jon S Anthony [this message]
1997-04-07  0:00       ` johnherro
1997-04-07  0:00     ` johnherro
1997-04-07  0:00       ` Robert Dewar
1997-04-08  0:00     ` Jeff Carter
1997-04-09  0:00     ` Looking for an Ada SCIENTIFIC UNITS checking package Ron House
1997-04-05  0:00   ` [Q] Returning Strings From A Function Robert Dewar
1997-04-06  0:00     ` John McCabe
1997-04-06  0:00       ` Robert Dewar
1997-04-05  0:00 ` John McCabe
1997-04-05  0:00   ` Robert A Duff
1997-04-05  0:00   ` Robert Dewar
1997-04-06  0:00     ` John McCabe
1997-04-06  0:00       ` Matthew Heaney
1997-04-06  0:00       ` Robert Dewar
1997-04-06  0:00         ` Nick Roberts
1997-04-07  0:00           ` Robert A Duff
1997-04-08  0:00             ` Nick Roberts
1997-04-07  0:00               ` Matthew Heaney
1997-04-06  0:00 ` John McCabe
replies disabled

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