Re: numbers to text

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu