comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.not.jrcarter@acm.not.spam.org>
Subject: Re: help with string splitting
Date: Thu, 09 Mar 2006 02:21:52 GMT
Date: 2006-03-09T02:21:52+00:00	[thread overview]
Message-ID: <4jMPf.4128$6I.3573@newsread3.news.pas.earthlink.net> (raw)
In-Reply-To: <1141863131.984654.144550@j52g2000cwj.googlegroups.com>

isaac2004 wrote:
> 
>    Length : Natural := 1; --total size of the encrypted message
>    J      : Integer := 0; --adjusts midpoint for odd and even strings
>    K      : Integer := 2; --counter for the encrypted string

What does it mean for Length to be zero, J to be < 0, or K < 1? It seems Length
and K should be Positive, and J, Natural.

>    while not End_Of_File(File => Indata) loop
> 
>       Get(
>          File => Indata,
>          Item => Codedtext (Length));
>       Length := Length + 1;
> 
>    end loop;

Now Length is the # of characters read + 1.

>    --Reconfigures the length to account for odd or even string lengths
> 
>    if Length REM 2 = 0 then
>       J := 0;
>    else
>       J := 1;
>    end if;

J := Length rem 2;

Do you really want to base this on the length of the input string, which is
Length - 1?

>    for I in 1..(Length - 1) loop
> 
>       Put(Item => Plaintext (I));
> 
>    end loop;

Put (Item => Plaintext (1 .. Length - 1) );

-- 
Jeff Carter
"Brave Sir Robin ran away."
Monty Python and the Holy Grail
59




  parent reply	other threads:[~2006-03-09  2:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-09  0:12 help with string splitting isaac2004
2006-03-09  0:44 ` jimmaureenrogers
2006-03-09  2:21 ` Jeffrey R. Carter [this message]
2006-03-09  5:54   ` isaac2004
2006-03-09 16:50     ` Martin Krischik
2006-03-09 18:31       ` isaac2004
2006-03-09 19:58         ` jimmaureenrogers
2006-03-10 10:45         ` Martin Krischik
2006-03-09 19:28     ` Jeffrey R. Carter
2006-03-09  7:43 ` Anders Wirzenius
2006-03-09 10:15 ` Georg Bauhaus
replies disabled

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