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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c8faa961aaf3fddb X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!news3.google.com!news.glorb.com!newsfeed.inode.at!news.hispeed.ch!linux2.krischik.com!news From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: help with string splitting Date: Thu, 09 Mar 2006 17:50:53 +0100 Organization: Cablecom Newsserver Message-ID: <2315080.YNFrSGcu4b@linux1.krischik.com> References: <1141863131.984654.144550@j52g2000cwj.googlegroups.com> <4jMPf.4128$6I.3573@newsread3.news.pas.earthlink.net> <1141883649.513514.212680@p10g2000cwp.googlegroups.com> NNTP-Posting-Host: 84-74-134-212.dclient.hispeed.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.hispeed.ch 1141923608 10028 84.74.134.212 (9 Mar 2006 17:00:08 GMT) X-Complaints-To: news@hispeed.ch NNTP-Posting-Date: Thu, 9 Mar 2006 17:00:08 +0000 (UTC) User-Agent: KNode/0.10.1 Xref: g2news1.google.com comp.lang.ada:3309 Date: 2006-03-09T17:50:53+01:00 List-Id: isaac2004 wrote: > First_Half_Index : Positive := 1; > Second_Half_Index : Positive := 2; > > >>for Code_Index in Codetext'Length loop > > if Code_Index <= Codetext'Length / 2 then > > Plaintext(First_Half_index) := Codetext(Code_Index); >> First_Half_Index := First_Half_Index + 2; >> else >> Plaintext(Second_Half_Index) := Codetext(Code_Index); >> Second_Half_Index := Second_Half_Index + 2; >> end if; >>end loop; > > this code confuses me > what is Code_Index and Codetext'Length Code_Index is a variable declared as part of for loop. C99 can do that as well - finally ;-) . See: http://en.wikibooks.org/wiki/Ada_Programming/Control#for_loop Codetext'Length is the length of the array - mind you I would have used Codetext'Range - which is range of valid indices for Codetext. See: http://en.wikibooks.org/wiki/Ada_Programming/Attributes/'Length http://en.wikibooks.org/wiki/Ada_Programming/Attributes/'Range Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com