From: Jim Rogers <jimmaureenrogers@worldnet.att.net>
Subject: Re: Ada Characters?
Date: Thu, 28 Feb 2002 02:28:11 GMT
Date: 2002-02-28T02:28:11+00:00 [thread overview]
Message-ID: <3C7D95C5.5040006@worldnet.att.net> (raw)
In-Reply-To: Qhgf8.10877$mG.44556@rwcrnsc54
Wannabe h4x0r wrote:
> I'm trying to figure out how to get my Ada program to single out ASCII
> control codes without hosing the output of the rest of the text file.
>
> Basically, I'm doing it like this...
> with Ada.Characters; use Ada.Characters.Handling;
>
> TEXT : string(1..200);
> chk_char: character; -- Check to see if this is a control character.
> chk_result : boolean;
>
> and the code goes like this ...
>
> for l in TEXT'range loop
> chk_char := TEXT(l);
> chk_result := Is_control(chk_char);
> if chk_result is True then
> if <how do I check to see if it's a NL(new line) character?> then
> NEW_LINE;
> else
> NULL;
> end if;
> else
> Put(chk_char); --Put each character individually
> end if;
> end loop;
with Ada.Characters.Latin_1;
with Ada.Characters.Handling; use Ada.Characters.Handling;
...
for l in TEXT'range loop
chk_char := TEXT(l);
if Is_Control(chk_char) then
if chk_char = Ada.Characters.Latin_1.LF then
Ada.Text_IO.Put(chk_char);
end if;
else
Ada.Text_IO.Put(chk_char);
end if;
end loop;
Jim Rogers
next prev parent reply other threads:[~2002-02-28 2:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-28 2:07 Ada Characters? Wannabe h4x0r
2002-02-28 2:28 ` Jim Rogers [this message]
2002-02-28 2:37 ` sk
2002-02-28 13:16 ` Georg Bauhaus
2002-02-28 19:30 ` Wannabe h4x0r
2002-03-01 10:50 ` Georg Bauhaus
2002-03-05 20:58 ` Nick Roberts
2002-03-06 1:45 ` Wannabe h4x0r
2002-02-28 22:54 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox