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: f43e6,9a0ff0bffdf63657 X-Google-Attributes: gidf43e6,public X-Google-Thread: 1108a1,9a0ff0bffdf63657 X-Google-Attributes: gid1108a1,public X-Google-Thread: fac41,9a0ff0bffdf63657 X-Google-Attributes: gidfac41,public X-Google-Thread: 103376,4b06f8f15f01a568 X-Google-Attributes: gid103376,public From: jdege@jdege.visi.com (Jeffrey C. Dege) Subject: Re: Software landmines (loops) Date: 1998/09/18 Message-ID: #1/1 X-Deja-AN: 392264778 References: <35f51e53.48044143@ <35EEF597.A1119EF4@draper.com> <35F5B529.6DC6A59A@draper.com> X-Complaints-To: abuse@visi.com X-Trace: ptah.visi.com 906085653 209.98.6.59 (Thu, 17 Sep 1998 21:27:33 CDT) NNTP-Posting-Date: Thu, 17 Sep 1998 21:27:33 CDT Newsgroups: comp.lang.eiffel,comp.object,comp.software-eng,comp.lang.ada Date: 1998-09-18T00:00:00+00:00 List-Id: On 18 Sep 1998 02:11:42 GMT, Robert I. Eachus wrote: >In article Matthew Heaney writes: > > > I have a string that was padded on the right with blanks. What I need > > to do is strip off the blanks, and return the index of the last > > non-blank character. > > Not to disagree with Matt, because he is trying to give an example >of how to reason about a problem, but there is a better approach: > > Ada.Strings.Fixed.Trim(S,Right)'Last > if Temp = S'First then return 0; else return Temp; end if; > end Last_Non_Blank_Index; > > Why bring this up? Because when doing ANY kind of engineering, >the first approach to try should be to ask, "Is there something in the >standard catalog that is available off-the-shelf?" It is so easy and >enjoyable to solve these problems in Ada, that we often lose sight of >how much grief using the library function will save later. And if you don't have a a catalog, off-the-shelf tool to solve the problem, create a tool and put it on the shelf... -- Personally, I think my choice in the mostest-superlative-computer wars has to be the HP-48 series of calculators. They'll run almost anything. And if they can't, while I'll just plug a Linux box into the serial port and load up the HP-48 VT-100 emulator.