Numbers to string?

How do I remove trailing zeros when converting Doubles to string?

Second question: where is the documentation fo the node: “Element.ToString”?

Thank you!

The trailing zeros are specifically because you’re converting from a double. Instead, convert to an integer first (Math.Floor is an easy option) and then convert to a string.

As for node documentation, right-click the node then Help. Or you can look up nodes on Dynamo Dictionary.
Dynamo Dictionary - Element.ToString

Great, thank you.

However, how do I go from 10.5000 to “10.5”?

Also, the Dynamo dictionary has no details on the nature of the data to feed that node.

Thank you.

String.Replace “0” with a “ ”, then use a a String.TrimTrailingWhitespace, then replace the “ ” with a “0”.

The dictionary hasn’t been updated since about Dynamo 2.4 - maybe older. Documentation can be found in the product now instead - place the node, highlight it, and hit F1 (might pull up the Revit help too) or right click and select ‘help’.

This has been a discussion on the forums for at least the last decade… anyhow - there’s a node for that; Spring Nodes Number.ToString

Also fairly trivial to accomplish with python

1 Like

yeah, NumberToString was not working, for some reason…