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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM,WEIRD_PORT autolearn=no autolearn_force=no version=3.4.4 X-Received: by 2002:ad4:430e:: with SMTP id c14mr23011077qvs.232.1572347290814; Tue, 29 Oct 2019 04:08:10 -0700 (PDT) X-Received: by 2002:a9d:1291:: with SMTP id g17mr16931272otg.76.1572347290578; Tue, 29 Oct 2019 04:08:10 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!feeder.erje.net!2.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!85.12.16.68.MISMATCH!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!j16no155973qtl.0!news-out.google.com!d16ni340qtp.0!nntp.google.com!j16no155970qtl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 29 Oct 2019 04:08:10 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:a03f:e3e9:4d00:1260:4bff:fe89:deb2; posting-account=kTRirAoAAACnF_wtAOSamxYBSVvmJuCa NNTP-Posting-Host: 2a02:a03f:e3e9:4d00:1260:4bff:fe89:deb2 References: User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <5d710dac-d172-4a31-899e-1bf95e220ed6@googlegroups.com> Subject: Re: gnat.string_split , howto manipulate slice numbers From: Alain De Vos Injection-Date: Tue, 29 Oct 2019 11:08:10 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 2428 X-Received-Body-CRC: 4182702162 Xref: reader01.eternal-september.org comp.lang.ada:57365 Date: 2019-10-29T04:08:10-07:00 List-Id: On Tuesday, October 29, 2019 at 9:35:31 AM UTC+1, Simon Wright wrote: > Alain De Vos writes: > > > I have a String_Split.Slice_Number , but I need the number before. > > ... > > J := String_Split.Slice_Count (Lines); > > for I in 2 .. J loop > > ... > > This works but , > > ... > > J := String_Split.Slice_Count (Lines) - 1 ; > > for I in 2 .. J loop > > ... > > This does not work. > > Error : > > lsblk.adb:91:44: operator for type "Slice_Number" defined at > > g-arrspl.ads:116, instance at g-strspl.ads:39 is not directly visible > > The error message says that there is an operator "-" for Slice_Number, > but it needs to be made directly visible; either "use String_Split", or > "use type String_Split.Slice_Count". > > However! clearly Lines is of some numeric type (Natural?) defined > earlier, for which operator "-" is visible. So use that operator > instead, by applying it before the conversion: > > J := String_Split.Slice_Count (Lines - 1); Lines is of type , Lines : String_Split.Slice_Set;