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,44035ca3ad75f32b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!proxad.net!news.wiretrip.org!feeder1.cambrium.nl!feed.tweaknews.nl!newshub2.home.nl!newshub1.home.nl!home.nl!skynet.be!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: integers into strings Date: Thu, 02 Feb 2006 05:48:55 +0000 Organization: Pushface Message-ID: References: <1138844312.140458.73880@z14g2000cwz.googlegroups.com> <5XdEf.326$UF1.191@newsread3.news.pas.earthlink.net> <1138851785.180604.32910@g47g2000cwa.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1138859326 21943 62.49.19.209 (2 Feb 2006 05:48:46 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Thu, 2 Feb 2006 05:48:46 +0000 (UTC) Cancel-Lock: sha1:hN1Zd1Zk+rdnGooGzx1yZa3pukM= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (darwin) Xref: g2news1.google.com comp.lang.ada:2745 Date: 2006-02-02T05:48:55+00:00 List-Id: "isaac2004" writes: > no im not converting the inputted number into a string im sorting > the digits of the value into ascending and descending order and then > making two different numbers out of it one ascending one descending The input is a string. A string is an array of characters, so if you can sort an array you can sort a string. I don't know what the point of this exercise is for you but some hints on how you might use attributes to help make a function that sorts a string of arbitrary length are in this .. with Ada.Text_IO; use Ada.Text_IO; procedure Isaac is Input : constant String := "1234"; Output : String (1 .. Input'Length); begin for I in Input'Range loop Output (Output'Last - (I - Input'First)) := Input (I); end loop; Put_Line (Output); end Isaac; Once you have a string, you can convert it to an integer using Integer'Value: Result : constant Integer := Integer'Value (Output);