Input a string (again)
From: Stefan Merwitz (thebiggestfan2002_at_yahoo.de)
Date: 01/29/05
- Next message: Stefan Merwitz: "Access types to records containing strings"
- Previous message: Stefan Merwitz: "Re: Input a string"
- Next in thread: Adrian Knoth: "Re: Input a string (again)"
- Reply: Adrian Knoth: "Re: Input a string (again)"
- Reply: Stefan Merwitz: "Re: Input a string (again)"
- Reply: tmoran_at_acm.org: "Re: Input a string (again)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 29 Jan 2005 09:55:02 +0100
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
- Next message: Stefan Merwitz: "Access types to records containing strings"
- Previous message: Stefan Merwitz: "Re: Input a string"
- Next in thread: Adrian Knoth: "Re: Input a string (again)"
- Reply: Adrian Knoth: "Re: Input a string (again)"
- Reply: Stefan Merwitz: "Re: Input a string (again)"
- Reply: tmoran_at_acm.org: "Re: Input a string (again)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|