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 autolearn=no autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!news.glorb.com!peer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!fx02.iad.POSTED!not-for-mail From: Shark8 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:35.0) Gecko/20100101 Thunderbird/35.0a1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: comparing characters in string References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@teranews.com NNTP-Posting-Date: Sun, 05 Oct 2014 12:16:14 UTC Organization: TeraNews.com Date: Sun, 05 Oct 2014 05:16:14 -0700 X-Received-Bytes: 1649 X-Received-Body-CRC: 2280904440 Xref: number.nntp.giganews.com comp.lang.ada:189405 Date: 2014-10-05T05:16:14-07:00 List-Id: On 10/5/2014 12:06 AM, Simon Wright wrote: > Shark8 writes: > >> function tt (a, b : in String) return Boolean is >> Target : Character renames a(a'first); >> Found : Constant Boolean:= True; >> Substring : constant String:= b(b'first+1..b'last); >> begin >> return (if (for some Ch of Substring => Ch = Target) then Found >> else not Found); >> end tt; > > Couldn't that just be > > function tt (a, b : in String) return Boolean is > Target : Character renames a(a'first); > Substring : constant String:= b(b'first+1..b'last); > begin > return (for some Ch of Substring => Ch = Target); > end tt; > Yes, but in the original posted code the return-value was false if found, true if not.