From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,612990d6f00ea42 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.68.135.231 with SMTP id pv7mr14871990pbb.8.1331009484461; Mon, 05 Mar 2012 20:51:24 -0800 (PST) Path: h9ni44604pbe.0!nntp.google.com!news2.google.com!news4.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.85.MISMATCH!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!news.stack.nl!aioe.org!.POSTED!not-for-mail From: "John B. Matthews" Newsgroups: comp.lang.ada Subject: Re: Can I convert a string of letters into an array? Date: Mon, 05 Mar 2012 23:51:22 -0500 Organization: The Wasteland Message-ID: References: <9891847.4305.1330998375979.JavaMail.geo-discussion-forums@vbai14> <3994111.4442.1331003406394.JavaMail.geo-discussion-forums@vblb5> NNTP-Posting-Host: LQJtZWzu+iKlBROuDg+IUg.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) X-Notice: Filtered by postfilter v. 0.8.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2012-03-05T23:51:22-05:00 List-Id: In article <3994111.4442.1331003406394.JavaMail.geo-discussion-forums@vblb5>, Will 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: -- John B. Matthews trashgod at gmail dot com