From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 3 Sep 93 18:18:25 GMT 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? Message-ID: <1993Sep3.181825.920@cfmu.eurocontrol.be> List-Id: In article 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