comp.lang.ada
 help / color / mirror / Atom feed
From: "Pascal Obry" <pascal.obry@der.edfgdf.fr>
Subject: Re: Newbie Q: Zero fill in Put
Date: 1997/09/03
Date: 1997-09-03T00:00:00+00:00	[thread overview]
Message-ID: <5uj7n4$c2q$1@cf01.edf.fr> (raw)
In-Reply-To: 340B809C.24AE@home.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1429 bytes --]




Another solution is to use the Ada.Text_IO.Editing package.
This package is able to format decimal number with great simplicity
(the functionalities are derived from the COBOL pictures) and is
very powerfull.

This is maybe a complex solution for a simple problem but in some
others complex cases it is very usefull.

-----------------------------------------

with Ada.Text_IO.Editing;

procedure Zfill is

   use Ada;

   type Num is delta 0.1 digits 10;

   package Text_Editing is new Text_IO.Editing.Decimal_Output (Num);

   X : Integer := 2;

begin
   Text_Editing.Put (Num (X), Pic => Text_IO.Editing.To_Picture ("999"));
end Zfill;

--

--|------------------------------------------------------------
--| Pascal Obry                               Team-Ada Member |
--|                                                           |
--| EDF-DER-IPN-SID- Ing�nierie des Syst�mes d'Informations   |
--|                                                           |
--| Bureau G1-010           e-mail: pascal.obry@der.edfgdf.fr |
--| 1 Av G�n�ral de Gaulle  voice : +33-1-47.65.50.91         |
--| 92141 Clamart CEDEX     fax   : +33-1-47.65.50.07         |
--| FRANCE                                                    |
--|------------------------------------------------------------
--|
--|   http://ourworld.compuserve.com/homepages/pascal_obry
--|
--|   "The best way to travel is by means of imagination"








  parent reply	other threads:[~1997-09-03  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-01  0:00 Newbie Q: Zero fill in Put Larry Coon
1997-09-02  0:00 ` John Herro
1997-09-02  0:00 ` Jacob Sparre Andersen
1997-09-05  0:00   ` Robert Dewar
1997-09-03  0:00 ` Pascal Obry [this message]
1997-09-04  0:00 ` Robert Dewar
1997-09-08  0:00 ` Larry Coon
replies disabled

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