comp.lang.ada
 help / color / mirror / Atom feed
* Input a string (again)
@ 2005-01-29  8:55 Stefan Merwitz
  2005-01-29  9:53 ` Adrian Knoth
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Merwitz @ 2005-01-29  8:55 UTC (permalink / 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



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-01-29 21:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-29  8:55 Input a string (again) Stefan Merwitz
2005-01-29  9:53 ` Adrian Knoth
2005-01-29 12:51 ` Stefan Merwitz
2005-01-29 21:03 ` tmoran

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