comp.lang.ada
 help / color / mirror / Atom feed
* Natural to String without space? (newbie question)
@ 2001-05-23 15:17 Tomas Hlavaty
  2001-05-23 22:37 ` DuckE
  2001-05-24  6:33 ` Pascal Obry
  0 siblings, 2 replies; 14+ messages in thread
From: Tomas Hlavaty @ 2001-05-23 15:17 UTC (permalink / raw)


Natural'Image returns string with space at the begining. Is there any
standard way how to get number without this additional character?

Thanks,

Tomas



^ permalink raw reply	[flat|nested] 14+ messages in thread
* RE: Natural to String without space? (newbie question)
@ 2001-05-23 22:45 Beard, Frank
  2001-05-24  7:56 ` Martin Dowie
  0 siblings, 1 reply; 14+ messages in thread
From: Beard, Frank @ 2001-05-23 22:45 UTC (permalink / raw)
  To: 'comp.lang.ada@ada.eu.org'

Probably the best way is:

Make your own common function, such as:

   with Ada.Strings;        use Ada.Srings;
   with Ada.Strings.Fixed;  use Ada.Srings.Fixed;

   function Trim(the_String : string) return string is
   begin
      return Trim(source => the_String,
                  side   => both);
   end Trim;


Then include it in a context clause, such as:

   with Ada.Text_Io;
   with Trim;

   procedure Trim_Test is

      number : natural := 1234;

   begin

      Ada.Text_Io.Put_Line(Trim(natural'image(number)));

   end Trim_Test;


Hope this helps.
Frank

-----Original Message-----
From: Tomas Hlavaty [mailto:hlavaty@labe.felk.cvut.cz]
Sent: Wednesday, May 23, 2001 11:18 AM
To: comp.lang.ada@ada.eu.org
Subject: Natural to String without space? (newbie question)


Natural'Image returns string with space at the begining. Is there any
standard way how to get number without this additional character?

Thanks,

Tomas
_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada.eu.org
http://ada.eu.org/mailman/listinfo/comp.lang.ada



^ permalink raw reply	[flat|nested] 14+ messages in thread
* RE: Natural to String without space? (newbie question)
@ 2001-05-24 21:55 Beard, Frank
  2001-05-25  7:30 ` Martin Dowie
  0 siblings, 1 reply; 14+ messages in thread
From: Beard, Frank @ 2001-05-24 21:55 UTC (permalink / raw)
  To: 'comp.lang.ada@ada.eu.org'

Well, you learn something new everyday.  I didn't know you
could do a rename and default a parameter when the parent
function was not defaulted.

Thanks for the info.

Frank

-----Original Message-----
From: Martin Dowie [mailto:martin.dowie@nospam.baesystems.com]

or,

   function Trim (Value : String;
                  Side  : Ada.Strings.Trim_End := Ada.Strings.Both)
      return String renames Ada.Strings.Fixed.Trim;


Beard, Frank <beardf@spawar.navy.mil> wrote in message
news:mailman.990658037.12046.comp.lang.ada@ada.eu.org...
> Probably the best way is:
>
> Make your own common function, such as:
>
>    with Ada.Strings;        use Ada.Srings;
>    with Ada.Strings.Fixed;  use Ada.Srings.Fixed;
>
>    function Trim(the_String : string) return string is
>    begin
>       return Trim(source => the_String,
>                   side   => both);
>    end Trim;
>
>
> Then include it in a context clause, such as:
>
>    with Ada.Text_Io;
>    with Trim;
>
>    procedure Trim_Test is
>
>       number : natural := 1234;
>
>    begin
>
>       Ada.Text_Io.Put_Line(Trim(natural'image(number)));
>
>    end Trim_Test;
>
>
> Hope this helps.
> Frank
>
> -----Original Message-----
> From: Tomas Hlavaty [mailto:hlavaty@labe.felk.cvut.cz]
> Sent: Wednesday, May 23, 2001 11:18 AM
> To: comp.lang.ada@ada.eu.org
> Subject: Natural to String without space? (newbie question)
>
>
> Natural'Image returns string with space at the begining. Is there any
> standard way how to get number without this additional character?
>
> Thanks,
>
> Tomas
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada.eu.org
> http://ada.eu.org/mailman/listinfo/comp.lang.ada


_______________________________________________
comp.lang.ada mailing list
comp.lang.ada@ada.eu.org
http://ada.eu.org/mailman/listinfo/comp.lang.ada



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2001-05-30  7:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-23 15:17 Natural to String without space? (newbie question) Tomas Hlavaty
2001-05-23 22:37 ` DuckE
2001-05-24  6:33 ` Pascal Obry
2001-05-29 21:04   ` Wes Groleau
2001-05-29 23:00     ` Jeffrey Carter
2001-05-30  7:19     ` Pascal Obry
  -- strict thread matches above, loose matches on Subject: below --
2001-05-23 22:45 Beard, Frank
2001-05-24  7:56 ` Martin Dowie
2001-05-24 21:55 Beard, Frank
2001-05-25  7:30 ` Martin Dowie
2001-05-25  8:30   ` Tomas Hlavaty
2001-05-25 15:05   ` Ehud Lamm
2001-05-28  7:31     ` Martin Dowie
2001-05-25 21:23   ` Ole-Hjalmar Kristensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox