comp.lang.ada
 help / color / mirror / Atom feed
* ToString?
@ 2002-03-12 13:16 Nazgul
  2002-03-12 13:24 ` ToString? Peter Hermann
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Nazgul @ 2002-03-12 13:16 UTC (permalink / raw)


Is there something like Integer'ToString(xxx) that converts an integer to a
string ?

Thanks.







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

* Re: ToString?
  2002-03-12 13:16 ToString? Nazgul
@ 2002-03-12 13:24 ` Peter Hermann
  2002-03-12 13:25 ` ToString? Ingo Marks
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Peter Hermann @ 2002-03-12 13:24 UTC (permalink / raw)


Nazgul <darkelf@aim.homelinux.com> wrote:
> Is there something like Integer'ToString(xxx) that converts an integer to a
> string ?
                       with ada.text_io;
                        use ada.text_io;
procedure imagevalue is

  i : integer;
  f : float;

begin null;

  ada.text_io.put_line("starting test program imagevalue");
  i := integer'value("4711");
  f :=   float'value("47.1");

  ada.text_io.put_line(integer'image(i));
  ada.text_io.put_line(  float'image(f));
  
end imagevalue;

-- 
--Peter Hermann(49)0711-685-3611 fax3758 ica2ph@csv.ica.uni-stuttgart.de
--Pfaffenwaldring 27 Raum 114, D-70569 Stuttgart Uni Computeranwendungen
--http://www.csv.ica.uni-stuttgart.de/homes/ph/
--Team Ada: "C'mon people let the world begin" (Paul McCartney)



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

* Re: ToString?
  2002-03-12 13:16 ToString? Nazgul
  2002-03-12 13:24 ` ToString? Peter Hermann
@ 2002-03-12 13:25 ` Ingo Marks
  2002-03-12 13:27 ` ToString? Larry Hazel
  2002-03-12 13:30 ` ToString? Martin Dowie
  3 siblings, 0 replies; 12+ messages in thread
From: Ingo Marks @ 2002-03-12 13:25 UTC (permalink / raw)


Nazgul wrote:

> Is there something like Integer'ToString(xxx) that converts an integer to
> a string ?
> 
> Thanks.

Integer to String: Integer'Image(xxx)
String to Integer: Integer'Value(yyy)




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

* Re: ToString?
  2002-03-12 13:16 ToString? Nazgul
  2002-03-12 13:24 ` ToString? Peter Hermann
  2002-03-12 13:25 ` ToString? Ingo Marks
@ 2002-03-12 13:27 ` Larry Hazel
  2002-03-12 13:30 ` ToString? Martin Dowie
  3 siblings, 0 replies; 12+ messages in thread
From: Larry Hazel @ 2002-03-12 13:27 UTC (permalink / raw)


Nazgul wrote:
> 
> Is there something like Integer'ToString(xxx) that converts an integer to a
> string ?
> 
> Thanks.

Integer'Image(xxx)

Larry



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

* Re: ToString?
  2002-03-12 13:16 ToString? Nazgul
                   ` (2 preceding siblings ...)
  2002-03-12 13:27 ` ToString? Larry Hazel
@ 2002-03-12 13:30 ` Martin Dowie
  2002-03-12 16:48   ` ToString? Jeffrey Carter
  3 siblings, 1 reply; 12+ messages in thread
From: Martin Dowie @ 2002-03-12 13:30 UTC (permalink / raw)



"Nazgul" <darkelf@aim.homelinux.com> wrote in message
news:a6kv3e$faat1$1@ID-107015.news.dfncis.de...
> Is there something like Integer'ToString(xxx) that converts an integer to
a
> string ?

try 'Image as in:

declare
   My_Integer : Integer := 10;
begin
   Put_Line (Integer'Image (My_Integer));
end;

The string will have a ' ' character at the front if positive.

To get more control about formatting check out package
Ada.Text_IO.Integer_IO (and Ada.Text_IO.Float_IO etc).





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

* Re: ToString?
  2002-03-12 13:30 ` ToString? Martin Dowie
@ 2002-03-12 16:48   ` Jeffrey Carter
  2002-03-13  8:38     ` ToString? Martin Dowie
  0 siblings, 1 reply; 12+ messages in thread
From: Jeffrey Carter @ 2002-03-12 16:48 UTC (permalink / raw)


Martin Dowie wrote:
> 
> try 'Image as in:
> 
> declare
>    My_Integer : Integer := 10;
> begin
>    Put_Line (Integer'Image (My_Integer));
> end;
> 
> The string will have a ' ' character at the front if positive.

More accurately, the string will have a leading space if the value is
not negative.

-- 
Jeffrey Carter



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

* Re: ToString?
  2002-03-12 16:48   ` ToString? Jeffrey Carter
@ 2002-03-13  8:38     ` Martin Dowie
  2002-03-13 22:18       ` ToString? Jeffrey Carter
  0 siblings, 1 reply; 12+ messages in thread
From: Martin Dowie @ 2002-03-13  8:38 UTC (permalink / raw)


> > The string will have a ' ' character at the front if positive.
>
> More accurately, the string will have a leading space if the value is
> not negative.

Ah, the '0' isn't a positive number thang!





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

* Re: ToString?
  2002-03-13  8:38     ` ToString? Martin Dowie
@ 2002-03-13 22:18       ` Jeffrey Carter
  2002-03-14  0:36         ` ToString? Adrian Knoth
  0 siblings, 1 reply; 12+ messages in thread
From: Jeffrey Carter @ 2002-03-13 22:18 UTC (permalink / raw)


Martin Dowie wrote:
> 
> > > The string will have a ' ' character at the front if positive.
> >
> > More accurately, the string will have a leading space if the value is
> > not negative.
> 
> Ah, the '0' isn't a positive number thang!

It's easy enough to test:

with Ada.Text_IO;
use Ada.Text_IO
procedure Is_Zero_Positive is
   Zero : constant := 0;
begin -- Is_Zero_Positive
   if Zero in Positive then
      Put_Line ("Zero is Positive");
   else
      Put_Line ("Zero is not Positive");
   end if;
end Is_Zero_Positive;

This puts "Zero is not Positive" to the standard output. QED.

-- 
Jeffrey Carter



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

* Re: ToString?
  2002-03-13 22:18       ` ToString? Jeffrey Carter
@ 2002-03-14  0:36         ` Adrian Knoth
  0 siblings, 0 replies; 12+ messages in thread
From: Adrian Knoth @ 2002-03-14  0:36 UTC (permalink / raw)


Jeffrey Carter <jeffrey.carter@boeing.com> wrote:

>> Ah, the '0' isn't a positive number thang!
> This puts "Zero is not Positive" to the standard output. QED.

That's why the church was against zero: "Zero is devil's stuff. In front
of a digit it minimizes its value by a factor of 10, behind any number
it multiplies by 10."

Of course, "10" has to be rewritten as 'X' :)

-- 
mail: adi@thur.de  	http://adi.thur.de	PGP: v2-key via keyserver

Treffen sich zwei Hellseher: "Dir gehts gut und wie gehts mir?"



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

* Re: ToString?
@ 2002-03-14  6:05 Christoph Grein
  2002-03-14 16:18 ` ToString? Jeffrey Carter
  0 siblings, 1 reply; 12+ messages in thread
From: Christoph Grein @ 2002-03-14  6:05 UTC (permalink / raw)


From: Jeffrey Carter <jeffrey.carter@boeing.com>

> > Ah, the '0' isn't a positive number thang!
>
> It's easy enough to test:
> 
> with Ada.Text_IO;
> use Ada.Text_IO
> procedure Is_Zero_Positive is
>    Zero : constant := 0;
> begin -- Is_Zero_Positive
>    if Zero in Positive then
>       Put_Line ("Zero is Positive");
>    else
>       Put_Line ("Zero is not Positive");
>    end if;
> end Is_Zero_Positive;
> 
> This puts "Zero is not Positive" to the standard output. QED.

You mean a test or a mathematical proof? For a test, this is OK.

For a proof, you have to prove first that Positive holds only
positive numbers :-)

Perhaps you also have to prove that the symbol 0 you use up there is really a 
representation of what you have in mind when speaking about the mathematical 
object called 0 :-)



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

* Re: ToString?
  2002-03-14  6:05 ToString? Christoph Grein
@ 2002-03-14 16:18 ` Jeffrey Carter
  2002-03-15 14:18   ` ToString? Ted Dennison
  0 siblings, 1 reply; 12+ messages in thread
From: Jeffrey Carter @ 2002-03-14 16:18 UTC (permalink / raw)


Christoph Grein wrote:
> 
> From: Jeffrey Carter <jeffrey.carter@boeing.com>
> 
> > > Ah, the '0' isn't a positive number thang!
> >
> > It's easy enough to test:
> >
> > with Ada.Text_IO;
> > use Ada.Text_IO
> > procedure Is_Zero_Positive is
> >    Zero : constant := 0;
> > begin -- Is_Zero_Positive
> >    if Zero in Positive then
> >       Put_Line ("Zero is Positive");
> >    else
> >       Put_Line ("Zero is not Positive");
> >    end if;
> > end Is_Zero_Positive;
> >
> > This puts "Zero is not Positive" to the standard output. QED.
> 
> You mean a test or a mathematical proof? For a test, this is OK.

I said "test". You are perhaps confused by my use of "QED", which of
course is TED's brother.

-- 
Jeffrey Carter



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

* Re: ToString?
  2002-03-14 16:18 ` ToString? Jeffrey Carter
@ 2002-03-15 14:18   ` Ted Dennison
  0 siblings, 0 replies; 12+ messages in thread
From: Ted Dennison @ 2002-03-15 14:18 UTC (permalink / raw)


Jeffrey Carter <jeffrey.carter@boeing.com> wrote in message news:<3C90CD5A.438EE1DA@boeing.com>...
> I said "test". You are perhaps confused by my use of "QED", which of
> course is TED's brother.

:-)

Actually, I have no brother. However, my wife is JED, and my kids are
PED and KED. :-)


-- 
T.E.D. 
Home     -  mailto:dennison@telepath.com (Yahoo: Ted_Dennison)
Homepage -  http://www.telepath.com/dennison/Ted/TED.html



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

end of thread, other threads:[~2002-03-15 14:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-14  6:05 ToString? Christoph Grein
2002-03-14 16:18 ` ToString? Jeffrey Carter
2002-03-15 14:18   ` ToString? Ted Dennison
  -- strict thread matches above, loose matches on Subject: below --
2002-03-12 13:16 ToString? Nazgul
2002-03-12 13:24 ` ToString? Peter Hermann
2002-03-12 13:25 ` ToString? Ingo Marks
2002-03-12 13:27 ` ToString? Larry Hazel
2002-03-12 13:30 ` ToString? Martin Dowie
2002-03-12 16:48   ` ToString? Jeffrey Carter
2002-03-13  8:38     ` ToString? Martin Dowie
2002-03-13 22:18       ` ToString? Jeffrey Carter
2002-03-14  0:36         ` ToString? Adrian Knoth

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