From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_00,TO_NO_BRKTS_FROM_MSSP autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,364deb6698b494cb X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-01 08:07:45 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail Newsgroups: comp.lang.ada From: Ted Dennison References: <4713a80b.0106010531.7f6f4da8@posting.google.com> Subject: Re: Ada String Issue: String within Strings Message-ID: X-Abuse-Info: When contacting newsranger.com regarding abuse please X-Abuse-Info: forward the entire news article including headers or X-Abuse-Info: else we will not be able to process your request X-Complaints-To: abuse@newsranger.com NNTP-Posting-Date: Fri, 01 Jun 2001 11:07:01 EDT Organization: http://www.newsranger.com Date: Fri, 01 Jun 2001 15:07:01 GMT Xref: archiver1.google.com comp.lang.ada:7977 Date: 2001-06-01T15:07:01+00:00 List-Id: In article , Ted Dennison says... >Ada.Text_IO.Get_Line (f_From, LineItem, Index); >while (not Ada.Text_IO.End_Of_File(f_From)) loop >Found := 0; >Found := Ada.Strings.Fixed.Index (LineItem(1..Index), Catch); >if Found > 0 then >Ada.Text_IO.Put_Line(f_To, LineItem(1..Index)); >end if; >end loop; Yikes! Please ignore my lack of formatting. That was my posting software speaking, not me. To answer your other question: yes, you do seem to be going about this the right way. The only other "peer review" comment I would make is: The two assignments into "Found" (and thus the "Found" variable itself) are unnessecary. You could remove them both and change the if statement to: if Ada.Strings.Fixed.Index (LineItem(1..Index), Catch) > 0 then Some might leave in the second assignment, but the first is completely unneeded. Also, it appears that you are not reading from the file within the loop. That means that the file pointer will not advance, and thus you will never reach the end of the file (unless the very first read gets you there), and thus the loop will iterate endlessly. Also, if the first read *does* read the only line in the file, the contents of what it read will never be checked. --- T.E.D. homepage - http://www.telepath.com/dennison/Ted/TED.html home email - mailto:dennison@telepath.com