From: dog.ee.lbl.gov!overload.lbl.gov!agate!doc.ic.ac.uk!uknet!mcsun!ub4b!cfmu! news@ucbvax.Berkeley.EDU (Stef Van Vlierberghe)
Subject: Re: How to assign STRINGs?
Date: 3 Sep 93 18:18:25 GMT [thread overview]
Message-ID: <1993Sep3.181825.920@cfmu.eurocontrol.be> (raw)
In article <EACHUS.93Aug27152310@spectre.mitre.org> eachus@spectre.mitre.org (R
obert I. Eachus) writes:
>
> -- try this as a "cleaned up" version:
>
> procedure PAR_STR_copy( Out_str : out string;
> In_Str : in string;
> Pad_Char : in character := ' ' ) is
> In_Str_Len: constant Integer := PAR_STR_length(In_Str);
> begin
> if In_Str_Len >= Out_Str'LENGTH
> then Out_Str := In_Str(In_Str'FIRST..In_Str'FIRST+Out_Str'LENGTH-1);
> else Out_Str := In_Str(In_Str'FIRST..In_Str'FIRST+In_Str_Len-1) &
> String'(In_Str_Len-1..Out_Str'LENGTH => Pad_Char);
> end if;
> end PAR_STR_copy;
Nice going Bob, but you were a bit over-focused on style I guess,
I would like to return Better_Ideas on this one :
String'(In_Str_Len+1..Out_Str'LENGTH => Pad_Char);
^^
or you get a CONSTRAINT_ERROR.
Hey, a new species of bug : off by 2 ! :-)
--
Stef VAN VLIERBERGHE Eurocontrol - Central Flow Management Unit
stef@cfmu.eurocontrol.be Avenue des Arts 19H
Tel: +32 2 729 33 42 B-1040 BRUSSELS
Fax: +32 2 729 32 16 Belgium
next reply other threads:[~1993-09-03 18:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-09-03 18:18 dog.ee.lbl.gov!overload.lbl.gov!agate!doc.ic.ac.uk!uknet!mcsun!ub4b!cfmu! [this message]
-- strict thread matches above, loose matches on Subject: below --
1993-09-07 21:56 How to assign STRINGs? Robert I. Eachus
1993-08-27 20:23 Robert I. Eachus
1993-08-27 19:00 Tucker Taft
1993-08-27 15:35 cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!noc.near.ne
1993-08-26 18:17 cis.ohio-state.edu!pacific.mps.ohio-state.edu!math.ohio-state.edu!howland
1993-08-26 16:54 cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland.
1993-08-26 14:09 Joe Hildebrand
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox