From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: ADA and return functions (Strings)
Date: Sun, 19 May 2002 05:38:57 -0500
Date: 2002-05-19T05:38:57-05:00 [thread overview]
Message-ID: <mailman.1021804803.32634.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: 3ce75220@news.comindico.com.au
----- Original Message -----
From: "ProLogic" <ProLogic@prologitech.ods.org>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
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);
next prev parent reply other threads:[~2002-05-19 10:38 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-19 7:20 ADA and return functions (Strings) ProLogic
2002-05-19 10:38 ` David C. Hoos, Sr. [this message]
2002-05-19 14:14 ` ProLogic
2002-05-19 14:30 ` Robert Dewar
2002-05-19 20:23 ` sk
2002-05-20 13:08 ` Marin David Condic
2002-05-21 2:51 ` sk
2002-05-21 10:50 ` John English
2002-05-21 12:52 ` Marin David Condic
2002-05-21 14:39 ` Ted Dennison
2002-05-21 16:27 ` Jean-Pierre Rosen
2002-05-21 20:39 ` sk
[not found] ` <3CEAB094.6B9E14F7@myob.com>
2002-05-21 21:07 ` sk
2002-05-21 19:52 ` sk
2002-05-19 20:27 ` David C. Hoos, Sr.
2002-05-20 3:06 ` Robert Dewar
2002-05-20 15:29 ` Kevin Cline
2002-05-20 17:16 ` Larry Kilgallen
2002-05-19 21:06 ` Jeffrey Carter
2002-05-20 1:58 ` tmoran
2002-05-20 2:28 ` David C. Hoos, Sr.
2002-05-20 3:05 ` tmoran
2002-05-20 3:35 ` David C. Hoos, Sr.
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox