Re: numbers to text
- Posted by bobspringett <bobspringett at WANADOO.FR> Aug 31, 2000
- 461 views
Thanks Irv Regards Bob ----- Original Message ----- From: irv <irv at ELLIJAY.COM> To: <EUPHORIA at LISTSERV.MUOHIO.EDU> Sent: Wednesday, August 30, 2000 10:34 PM Subject: Re: numbers to text > On Wed, 30 Aug 2000, you wrote: > > I have a sequence of many floating point numbers. > > I would like to check the length of each of them using getTextExtent() but > > text data is required by this function and I am getting a > > type check error when I use sequence[n]. > > If I include the variable assigned to sequence[n] in quotation marks it will > > print the name of the variable.. How do I change the > > value of the variable into text notation. ie what's the Euphoria equivalent > > of the basic STR$() function. > > I've read the sequence doc. and the examples for string literals are there > > but I can't find anything for string variables.Thanks in > > advance. > > Regards > > Bob > > -- see sprintf > object x x = {1234356.7890, 3.1415, 2} > for i = 1 to length(x) do -- convert numbers to strings "in place" > x[i] = sprintf("%g",x[i]) -- replace the %g with %8.2f or whatever format u > like > end for > ? length(x[2]) puts(1, x[2]) > -- > Regards, > Irv