Another important data type is a string. Strings represent pieces of text like “Hello World!” or “https://xod.io”. XOD depicts the string type in yellow.
Tweak nodes for strings are a bit special. For optimisation purposes XOD needs to know the maximum length of the tweaked string, so there are several ones available. When you want to add a string tweak, choose the smallest one necessary.
The standard library contains a few nodes to work with strings and text. One useful node is concat
. It joins several parts into a single one. This allows creating a message out of several data sources.
Try strings in runtime.
tweak-string-16
s to change the message.concat
and bind an exclamation point to it.Note, the if-else
node can work with numbers or strings depending on the incoming value type. The pins which accept various types are called generic. You can spot them by the little dot in the center.
If you want to bind a string value to a generic pin, you should enquote it because the number 3.14
and the string "3.14"
are different things. The quotes explicitly tell XOD you’ve meant a string value.