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,37c1f61bd0b7914 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!e23g2000prf.googlegroups.com!not-for-mail From: "jimmaureenrogers@worldnet.att.net" Newsgroups: comp.lang.ada Subject: Re: Converting Type Characters to type string Date: Tue, 1 Apr 2008 05:00:49 -0700 (PDT) Organization: http://groups.google.com Message-ID: <6e94c181-9133-4ad7-9048-745386d5991c@e23g2000prf.googlegroups.com> References: <8f5967a7-17ab-4eda-80fc-5cb58ae011f5@s50g2000hsb.googlegroups.com> <2d291584-9cb9-4a3f-8626-7b7066e60566@59g2000hsb.googlegroups.com> <5052229e-61c3-401d-93b6-a95edee29e58@m71g2000hse.googlegroups.com> <76c5beff-f3e9-44ae-ab96-7da01ea17a65@s37g2000prg.googlegroups.com> NNTP-Posting-Host: 75.70.240.233 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1207051249 18796 127.0.0.1 (1 Apr 2008 12:00:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 1 Apr 2008 12:00:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: e23g2000prf.googlegroups.com; posting-host=75.70.240.233; posting-account=fZH-XgkAAADP-Rf8L8ppyFIdKUfh90k4 User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20714 Date: 2008-04-01T05:00:49-07:00 List-Id: On Apr 1, 5:22 am, jedivaughn wrote: > On Apr 1, 1:34 am, Simon Wright wrote: > > > jedivaughn writes: > > > Ok So I've almost solved my problem. my only question now is I need > > > to convert one character to an integer. I know the input is a > > > integer so it's not going to give me a constraint error but how will > > > I convert one character to an integer? > > > Make a one-character String holding your Character & convert that? > > > with ada.text_io; > > procedure blah is > > i : integer := integer'value (string'(1 .. 1 => '7')); > > begin > > ada.text_io.put_line ("i => " & integer'image (i)); > > end blah; > > not exactly what I was looking for. I have a number stored in a > character. and I want to turn that into a integer. so I can add it to > another integer. So say I have the number '5' stored in a character > and I want that in an integer not a character or string. how would I > do that? Given your stated goal of converting decimal integers into Roman numerals, your goal of dealing with one digit at a time will always lead you astray. Why not read the entire set of digits as an integer directly? Given the number 1994, your result should be MCMXCIV. You cannot arrive at the correct result simply reading one digit at a time. Jim Rogers