comp.lang.ada
 help / color / mirror / Atom feed
From: Stefan Merwitz <thebiggestfan2002@yahoo.de>
Subject: Input a string (again)
Date: Sat, 29 Jan 2005 09:55:02 +0100
Date: 2005-01-29T09:55:02+01:00	[thread overview]
Message-ID: <36119gF4r0h1aU2@individual.net> (raw)

Hello everybody,

I'm nearly at despairing. After I'm now able to input a string (30 
chars), I need to cancel the loop in the following source, when the user 
enters an empty line:

     function InputString return string is
         sString: String(1..30); -- constrained
         iString_Length: Natural range 0..sString'Last;
     begin
         Skip_Line;
         Get_Line(sString, iString_Length);
         if iString_Length = sString'Last then
             Skip_Line;
         end if;
         return sString;
     end;

     bContinue: boolean := true;
     begin
         while bContinue loop
             sHobbyStr := InputString;
             if Trim(To_Unbounded_String(sHobbyStr), Both) = "" then
                 bContinue := false;
             else
                 Put(sHobbyStr);
             end if;
         end loop;
     end;

But unfortunately, neither
     Trim(To_Unbounded_String(sHobbyStr), Both) = ""
nor
     sHobbyStr = "                              " (30 empty chars)
work.

All I want is to cancel that loop when nothing is entered, help!


Could you please help me,

Stefan



             reply	other threads:[~2005-01-29  8:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-29  8:55 Stefan Merwitz [this message]
2005-01-29  9:53 ` Input a string (again) Adrian Knoth
2005-01-29 12:51 ` Stefan Merwitz
2005-01-29 21:03 ` tmoran
replies disabled

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