From: Pascal Obry <pascal@obry.net>
To: jedivaughn <jedivaughn14@gmail.com>
Subject: Re: Converting Type Characters to type string
Date: Sun, 30 Mar 2008 22:19:43 +0200
Date: 2008-03-30T22:19:44+02:00 [thread overview]
Message-ID: <47EFF5DF.401@obry.net> (raw)
In-Reply-To: <45128c93-6001-47bd-9feb-d82ac04a5515@k13g2000hse.googlegroups.com>
jedivaughn a �crit :
> I am looking for a way to convert a group of characters to a string.
> For the program I am writing I am having the user input a group of
> characters and comparing them. But I also need the characters in the
> form of a string later on so I can use
>
> int := Integer'Value(str);
Looks like bad C habit to me :)
In Ada a String is defined as:
type String is array (Positive range <>) of Character;
So in your case you have something like this:
C : Character;
Get (C);
To get characters from user. Now to store them. Let's say you are going
to check 10 characters max:
Str : String (1 .. 10);
Index : Natural := 0;
To store each character:
Get (C);
Index := Index + 1;
Str (Index) := C;
At the end, Str (1 .. Index) contains all the characters entered by the
user as a string. Looks like this is what you are looking for, right?
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
next prev parent reply other threads:[~2008-03-30 20:19 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-30 20:04 Converting Type Characters to type string jedivaughn
2008-03-30 20:19 ` Pascal Obry [this message]
2008-03-30 21:08 ` jedivaughn
2008-03-30 21:28 ` jimmaureenrogers
2008-03-30 21:38 ` Ludovic Brenta
2008-03-30 21:48 ` Georg Bauhaus
2008-03-30 23:52 ` jedivaughn
2008-03-31 3:04 ` george.priv
2008-03-31 4:00 ` tmoran
2008-03-31 8:54 ` Ludovic Brenta
2008-03-31 9:59 ` Dmitry A. Kazakov
2008-03-31 10:59 ` Jean-Pierre Rosen
2008-03-31 13:50 ` jedivaughn
2008-03-31 14:11 ` Ludovic Brenta
2008-03-31 14:21 ` Dmitry A. Kazakov
2008-03-31 14:44 ` jedivaughn
2008-03-31 15:41 ` Adam Beneschan
2008-03-31 20:26 ` Maciej Sobczak
2008-03-31 22:06 ` Georg Bauhaus
2008-03-31 22:33 ` Adam Beneschan
2008-04-01 1:00 ` jedivaughn
2008-04-01 5:34 ` Simon Wright
2008-04-01 11:22 ` jedivaughn
2008-04-01 12:00 ` jimmaureenrogers
2008-04-01 13:22 ` jedivaughn
2008-04-01 17:03 ` Adam Beneschan
2008-04-01 21:11 ` Simon Wright
2008-04-01 22:22 ` jedivaughn
2008-04-03 5:54 ` tmoran
2008-04-03 14:38 ` Adam Beneschan
2008-04-01 16:58 ` Adam Beneschan
2008-03-31 15:45 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox