How to format numbers/text to 2 decimal places?

I am using Elefront to generate text objects from a spreadsheet. I need these numbers to be displayed at 2 decimal places. They currently go from 0 to MANY decimal places. I can’t find a way to format numeric output to just 2 decimals. Feeling dumb - it could be Excel - or Grasshopper - or something in Notepad…

TIA,
Robb

Hope it helps you out…

Thanks… Just what I needed.

Robb

Perhaps someone may find this useful so I thought I’d share. I wrote this Python script to make number formatting a bit more intuitive for my own uses. Note: the script only adds/ removes padding, it doesn’t do anything for exponents.

And FYI, below is s a link to David Rutten’s post on the subject on the old grasshopper site.
Regards,
Ole

format_decimal.gh (5.5 KB)

And here is a more esoteric one about adding leading zeros in Python!

https://dancergraham.github.io/blog/any-way-the-wind-blows/

i use this component

fg

the Round component in Rhino 6 + Grasshopper 1.0.0007 does not look like that. Where did that one come from? Also, I can’t seem to get the desired results from the expression…

Feeling stupid.

@rcmcdougle - that’s a Pufferfish component

OK - I don’t have Pufferfish installed. I solved the Expression failure. SubSet was putting out a string. Adding a Number component between SubSet and Expression fixed it.

You can use function

You can change the number in the function to however many decimals you desire.

My personal fave. Can use it to round to a floating point or the nearest multiple of an integer

Can you explain me what means 0:0.00 please. Is zero divided( : ) tò 0.00? Why “…, x”? If i input 3 variabile x y z i have tò text “, x ; y; z”?