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,1b6f0735bc6de58e X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!k38g2000vbn.googlegroups.com!not-for-mail From: Ludovic Brenta Newsgroups: comp.lang.ada Subject: Re: index check failure - constraint error Date: Fri, 1 Apr 2011 05:13:30 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <64114572-3a55-4a5f-b1f8-70ee0a67fd2f@glegroupsg2000goo.googlegroups.com> <50a187ed-f454-47c5-af00-e40a0fc4eb2f@p3g2000vbv.googlegroups.com> NNTP-Posting-Host: 153.98.68.197 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1301660010 31798 127.0.0.1 (1 Apr 2011 12:13:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 1 Apr 2011 12:13:30 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: k38g2000vbn.googlegroups.com; posting-host=153.98.68.197; posting-account=pcLQNgkAAAD9TrXkhkIgiY6-MDtJjIlC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.6) Gecko/2009012111 Red Hat/3.0.6-1.el5 Firefox/3.0.6,gzip(gfe) Xref: g2news2.google.com comp.lang.ada:19636 Date: 2011-04-01T05:13:30-07:00 List-Id: tonyg wrote on comp.lang.ada: > On Apr 1, 12:12=A0pm, Egil H=F8vik wrote: > >> In your loop you assume The_String'First=3D1, >> that may not always be the case, especially if >> you call this function on array slices. >> Try "for count in The_String'Range loop" instead Well spotted. > Worked a treat - still don't understand why the first character in the > string is not 1 though, > Thanks for the help S : constant String :=3D "***123***"; I : constant Integer :=3D String_To_Integer (S (4 .. 6)); Inside String_To_Integer, The_String'First=3D4. S (4 .. 6) is called a "slice". -- Ludovic Brenta.