On 2/17/2023 6:41 PM, gene heskett wrote:
The str dumps the rest to /dev/null on finding the decimal point?
str(number) turns a number into a string, a sequence of characters.
You cannot control how many places after the decimal it will include.
For instance: str(1.2) is "1.2" and str(1.23) is "1.23", but str(1.0)
is "1" and str(1.000001) is also "1".
Maybe there is a good reason for it but IMO it should continue till it
finds the terminator char.
You're thinking the wrong direction. In this case, str() is not
consuming a string - it's consuming a number and there is no terminator.
Or even using the echo(diatrim) return as it makes a proper string out
of a number even if its an f.p number. It will never be more than 2
digits with a . between them
something like text=echo(diatrim); ??
That is exactly what str() will do with a number.
str() will also concatenate strings.
So if you have a string "Gene" and a number 2023, and you want "Gene
2023", you could do something like:
name = "Gene";
year = 2023;
label = str(name, " ", year);
and the result would be "Gene 2023", which you could then feed to text().