comp.lang.ada
 help / color / mirror / Atom feed
From: "Gep" <nodsa@sdfsffds.net>
Subject: Re: string manipulation
Date: Sun, 8 Dec 2002 13:34:14 -0500
Date: 2002-12-08T13:34:14-05:00	[thread overview]
Message-ID: <FgMI9.5491$1f7.39004@wagner.videotron.net> (raw)
In-Reply-To: 3DF2AD96.6010100@acm.org


"Jeffrey Carter" <jrcarter@acm.org> wrote in message
news:3DF2AD96.6010100@acm.org...
> Gep wrote:
> >
> >  while not valid
> > loop
> >  get_line(V_string, V_length);
> >
> >  if V_length= V_string'length then
> >       Skip_Line;
> >       Valid := True;
> >  else
> >      valid :=false;
> >      Put("invalid");
> >  end if;
> > end loop;
>
> This looks better then that other code. You can do this. It will
> repeatedly get a line until it gets one that is exactly V_String'Length
> characters. If that's what you want. I don't see what it has to do with
> declaring a string variable of a specific length.
>
> Valid is sort of useless here, as well as providing an opportunity for
> errors. You can forget to assign to it, or assign the wrong value. I
> think this would read better without it:
>
> loop
>     Get_Line (...);
>
>     if V_Length = V_String'Length then
>        Skip_Line;
>
>        exit;
>     end if;
>
>     Put ("invalid");
> end loop;
>


What I wanted is a procedure that couldget both, a string with a fixed
length or a variable length. But it is ok I'm gonna done do two seprate
procedures. I thnik it is going to be more clear that way

thanks anyway for help.






  reply	other threads:[~2002-12-08 18:34 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-07 23:14 string manipulation Gep
2002-12-07 23:20 ` Gep
2002-12-08  2:24   ` Jeffrey Carter
2002-12-08 18:34     ` Gep [this message]
2002-12-08 14:02   ` Marin David Condic
2002-12-08  0:07 ` Jacob Sparre Andersen
2002-12-08  0:12 ` James S. Rogers
  -- strict thread matches above, loose matches on Subject: below --
1998-09-22  0:00 String Manipulation SiliconJesus
1998-09-23  0:00 ` David C. Hoos, Sr.
1998-04-08  0:00 Howard Davies
replies disabled

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