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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c8a853b515609781 X-Google-Attributes: gid103376,public From: "Bob Fletcher" Subject: Re: strings to floats/integers Date: 1998/09/03 Message-ID: <01bdd730$3130dd90$f330ea9e@ukp03332>#1/1 X-Deja-AN: 387452916 References: <35e41033.9324314@200.223.0.87> Organization: Logica UK Limited Newsgroups: comp.lang.ada Date: 1998-09-03T00:00:00+00:00 List-Id: You can use two things called 'image and 'value. The first converts to a string from another type (e.g. Put(integer'image(2));) The second goes the other way (e.g. x := 1 + integer'value("2");) For your example use myfloat := float'value(mystring); The only word of warning I would give is that you should be careful that whatever is in the string can logically represent the type being converted to. Maybe someone else can enlighten us on what happens if this is not the case, I can't remember. Hope this helps, Bob Fletcher bob@radge.globalnet.co.uk http://www.users.globalnet.co.uk/~radge/ Mr Pinga wrote in article <35e41033.9324314@200.223.0.87>... > can anyone tell me how to convert a string to a float and/or integer?? > > i need to go from the form mystring := "123.4567" to the form myfloat > := 123.4567 > > or mystring := "12345" to myinteger := 12345 > > please, I am getting quite desperate. I have looked all through the > ADA95 reference manual, and looked all over the WWW but i cant find > anything. The closest i have found is Unchecked_Conversion but it > converts things to gibberish so mystring := "3" becomes myfloat := > 0.0E000 etc etc > > any info greatly appreciated > > Jared > > ps. Please email me if possible because i dont have a proper usenet > connection > >