From: "John B. Matthews" <nospam@nospam.invalid>
Subject: Re: Can I convert a string of letters into an array?
Date: Mon, 05 Mar 2012 23:51:22 -0500
Date: 2012-03-05T23:51:22-05:00 [thread overview]
Message-ID: <nospam-22AFE6.23512205032012@news.aioe.org> (raw)
In-Reply-To: 3994111.4442.1331003406394.JavaMail.geo-discussion-forums@vblb5
In article
<3994111.4442.1331003406394.JavaMail.geo-discussion-forums@vblb5>,
Will <willmann817@gmail.com> wrote:
> On Monday, March 5, 2012 9:58:46 PM UTC-5, Jeffrey Carter wrote:
> > On 03/05/2012 06:46 PM, Will wrote:
> > >
> > > How do I convert a string of letters into an array? I am not sure
> > > how to sort the letters in the form of a string but I know how to
> > > do it using an array. Then how do I convert that array back to a
> > > string after I am done sorting it?
> >
> > You could instantiate Ada.Containers.Generic_Array_Sort for the
> > array type String.
>
> Jeff, I am a beginner at Ada, so I have no idea what you mean by that ha ha?
Jeff: In Ada, a String is an array of Character:
type String is array(Positive range <>) of Character;
You can create an instance of Generic_Array_Sort that sorts the
Characters in a String like this:
procedure Sort is new Ada.Containers.Generic_Array_Sort(
Index_Type => Positive,
Element_Type => Character,
Array_Type => String);
There's a complete example here:
<http://home.roadrunner.com/~jbmatthews/jumble.html>
--
John B. Matthews
trashgod at gmail dot com
<http://sites.google.com/site/drjohnbmatthews>
next prev parent reply other threads:[~2012-03-06 4:51 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-06 1:46 Can I convert a string of letters into an array? Will
2012-03-06 2:22 ` Shark8
2012-03-06 2:58 ` Jeffrey Carter
2012-03-06 3:10 ` Will
2012-03-06 4:51 ` John B. Matthews [this message]
2012-03-06 5:00 ` John B. Matthews
2012-03-06 6:29 ` Jeffrey Carter
2012-03-06 7:51 ` anon
2012-03-08 9:48 ` tonyg
2012-03-08 11:30 ` Simon Wright
2012-03-08 13:06 ` mockturtle
2012-03-08 14:04 ` Simon Wright
2012-03-06 3:13 ` Will
2012-03-06 8:29 ` Ludovic Brenta
[not found] ` <zLednfMxUtyBtsvSnZ2dnUVZ_oSdnZ2d@earthlink.com>
2012-03-07 10:39 ` Jacob Sparre Andersen
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox