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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,64a2795a04707a01 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!wn11feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Converting Integer / Float to String Reply-To: no to spamers (No@email.given.org) References: X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Thu, 17 Jul 2008 08:05:02 GMT NNTP-Posting-Host: 12.65.24.30 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1216281902 12.65.24.30 (Thu, 17 Jul 2008 08:05:02 GMT) NNTP-Posting-Date: Thu, 17 Jul 2008 08:05:02 GMT Organization: AT&T Worldnet Xref: g2news2.google.com comp.lang.ada:6915 Date: 2008-07-17T08:05:02+00:00 List-Id: Another way is to use the "Ada.Float_Text_IO" package. Especially when you may normally need the Float_Text_IO package in the program. Read a integer from a string (buffer) using the "Get" routine: procedure Get ( From : in String ; Item : out Num ; Last : out Positive ) ; but it require an extra variable. String_Position : Positive ; ... Get ( Value, Float_String, String_Position ) ; ... In , "Alexander Camek" writes: >Hi List, > >is there another way to convert a given String to an Integer or Float type? > >I am currently using some code like this: > >begin >Value :=Float'Value(Float_String); >exception >when Constraint_Error => Value := 0.0; >end; > >For me this is very ugly and a big hack. >Thanks for any idea. > >Greetings > >Alexander > >