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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,94b44ecb42c031b9 X-Google-Attributes: gid103376,public From: Matthias Teege Subject: Re: Searching for an object Date: 2000/08/22 Message-ID: <87vgwte9yo.fsf@moon.mteege.de>#1/1 X-Deja-AN: 661122599 Sender: matthias@moon.mteege.de References: <87g0nyy1kk.fsf@moon.mteege.de> Organization: DVZ Datenverarbeitungszentrum Mecklenburg-Vorpommern GmbH Content-Type: text/plain; charset=iso-8859-1 User-Agent: Gnus/5.0803 (Gnus v5.8.3) Emacs/20.5 Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-08-22T00:00:00+00:00 List-Id: tmoran@bix.com writes: > > if in_field = "field1" and for_this_string = "foo" > > then > > result = "found"; > > if in_field = "field2" and for_this_string = "foo" > > then > > result = "found"; > > > >I'm looking for a short notation like > >"record.$fieldname". I hope I can make you understand. :-) > I'm confused. The example pseudo-code indicates there are > two fields, "in_field" and "for_this_string", while > record.$fieldname suggests, to me, that you want multiple > different field names in your record. No, the pseudo code deceive. I have an record type with for instance two fields and "in_field" stands for the fieldname and "for_this_string" stands for the value. type Customer is record lastname : String ( 1..10 ); firstname : String ( 1..10 ); end record Cust : Customer; Cust.lastname = "Teege "; Cust.firstname = "Matthias "; Now I build an container with a lot of customers and wan't to find one of them. For this case I look for an procedure which I can pass two arguments. Not only the searchstring (Teege) but also the fieldname (lastname). A appropriate call looks like this: Find("lastname", "Matthias "); -- not found Find("lastname", "Teege "); -- found > If you don't like the successive "if"s, how about Yes, that is the problem, too many "if's". :-) > if for_this_string = "foo" > and then ada.strings.fixed.index("field1 field2", in_field) /= 0 then > result := "found"; > (assuming, of course, that all strings are the indicated length). > If I understand correctly what you mean by record.$fieldname, why > not just have the record contain an array of the fields? You, TED and the others gave a lot of input and I will try to recycle some of them. ;-) Many thanks Matthias -- Matthias Teege -- matthias@mteege.de -- http://emugs.de make world not war PGP-Key auf Anfrage