Skip to main content

Data Types\Number\ Conversion


Response_Value_NumberToString.png Number To String

Ceiling Node.png


The Number to String node enables the user to convert a numerical value to a string by either typing in a numerical value in the Number field or by attaching a value or a variable node to that port. Then once the conversion is executed, the resulting string can be acquired through the String port.




String To Number

Turns a piece of text into a number you can do math with or compare.

What it does

This node reads the text you give it and hands back the matching number. For example, the text “42” comes back as the number 42, and “3.14” comes back as 3.14. Negative values like “-7” work too. This is handy when a value arrives as text—say from something the user typed—but you need it as a real number for calculations or comparisons.

The conversion only works when the text actually looks like a number. If you pass in something that isn’t a number, such as “hello”, you get no number back (an empty result). The original text is never changed—you simply get a new number value. This node is the reverse of the “Number To String” node on the same page.

Inputs

Port Type What to connect
Execute Trigger Wire this from the previous node’s Execute output.
String Text The text you want turned into a number, such as “42” or “3.14”.

Outputs

Port Type What you get
Execute Trigger Fires once the node has finished.
Number Number The number that matches the text. If the text isn’t a number, you get an empty result.

Example

String input “3.14”
Number output 3.14

Tips

  • Make sure the text really is a number. Extra characters like spaces or a currency sign can leave you with an empty result.
  • If a value reaches you as text but you need to add, subtract, or compare it, run it through this node first.