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.3 required=5.0 tests=BAYES_00,INVALID_MSGID, LOTS_OF_MONEY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fc0458fe4be14174 X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Re: Converting string to float and integer Date: 2000/01/09 Message-ID: <387815e9_4@news1.prserv.net>#1/1 X-Deja-AN: 570234745 Content-transfer-encoding: 7bit References: <3vSd4.35559$E36.436449@news2-hme0> Content-Type: text/plain; charset="US-ASCII" X-Complaints-To: abuse@prserv.net X-Trace: 9 Jan 2000 05:00:25 GMT, 32.101.8.149 Organization: Global Network Services - Remote Access Mail & News Services Mime-version: 1.0 Newsgroups: comp.lang.ada Date: 2000-01-09T00:00:00+00:00 List-Id: In article <3vSd4.35559$E36.436449@news2-hme0> , "Daniel Platt" wrote: > I am tring to convert a string into a float and/or integer. Every scalar type comes with predefined attributes to convert from string to that type, and from that type to a string. Convert_String_To_Int: declare Image : constant String := "42"; Value : constant Integer := Integer'Value (Image); begin null; end Convert_String_To_Int; Convert_Int_To_String: declare Value : constant Integer := 42; Image : constant String := Integer'Image (Value); begin null; end Convert_Int_To_String; To convert between Float and String, use Float'Image and Float'Value. To convert between any scalar type T and String, use T'Image and T'Value. -- Help keep evolution in the science classroom and religion out: become a member of the National Center for Science Education.