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.1 required=5.0 tests=AXB_XMAILER_MIMEOLE_OL_024C2, BAYES_00,MAILING_LIST_MULTI,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,228dbf2f126edf08 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-19 03:40:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!ihug.co.nz!newsfeed00.sul.t-online.de!t-online.de!fr.usenet-edu.net!usenet-edu.net!enst!enst.fr!not-for-mail From: "David C. Hoos, Sr." Newsgroups: comp.lang.ada Subject: Re: ADA and return functions (Strings) Date: Sun, 19 May 2002 05:38:57 -0500 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: References: <3ce75220@news.comindico.com.au> Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1021804803 33611 137.194.161.2 (19 May 2002 10:40:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Sun, 19 May 2002 10:40:03 +0000 (UTC) Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:24371 Date: 2002-05-19T05:38:57-05:00 ----- Original Message ----- From: "ProLogic" Newsgroups: comp.lang.ada To: Sent: May 19, 2002 2:20 AM Subject: ADA and return functions (Strings) > Why does ADA return extra spaces in for example the following function... > > function getVersion return String is > begin > return Version.Major'img & "." & Version.Minor'img; > end; Well, ADA doesn't return anyting, but the Ada function you've supplied above will return a string with spaces because the Image attributes of non-negative numeric objects is defined with a leading space where the '-' would be if the object had a negative value. This is true even for types that are declared not to have negative values. The best way to do this without spaces is something like this: return Ada.Strings.Fixed.Trim (Version.Major'img, Ada.Strings.Left) & "." & Ada.Strings.Fixed.Trim (Version.Minor'img, Ada.Strings.Left);