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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e8bf1841fa090915 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-11-05 14:16:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Ada Strings Libraries for the clueless. Date: 05 Nov 2002 22:17:01 +0000 Organization: Pushface Sender: simon@smaug.pushface.org Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1036534614 21487 62.49.19.209 (5 Nov 2002 22:16:54 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Tue, 5 Nov 2002 22:16:54 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:30405 Date: 2002-11-05T22:17:01+00:00 List-Id: Caffeine Junky writes: > Ada.Strings.Fixed > > function Index (Source : in String; Pattern : in String; > Going : in Direction := Forward; > Mapping : in Maps.Character_Mapping := Maps.Identity) > return Natural; > > > Now, the gist of this function is pretty clear. It looks at a String > and returns the number of how many Characters are in the string(I'm > assuming.) But what's this "Pattern" string I'm supposed to pass to > it? Does it only count the characters in the String that match the > Pattern given in the Pattern variable? If you read on to (58) you find Each Index function searches for a slice of Source, with length Pattern'Length, that matches Pattern with respect to Mapping; the parameter Going indicates the direction of the lookup. If Going = Forward, then Index returns the smallest index I such that the slice of Source starting at I matches Pattern. If Going = Backward, then Index returns the largest index I such that the slice of Source starting at I matches Pattern. If there is no such slice, then 0 is returned. If Pattern is the null string then Pattern_Error is propagated. which seems pretty clear :-) (except perhaps the Mapping part)