添加字符串
本示例介绍了如何使用SmartNode中的“添加字符串“节点给输入的字符串添加前后缀。
SmartNode中用到的node有:注入节点、添加字符串节点、调试节点。
程序设计如下:
相关节点的配置如下:
Prepend(前缀),即添加在输入的字符串之前;Append(后缀),即添加在输入的字符串之后。
配置完成后,点击右上角的部署(Deploy)按钮。点击注入节点,在调试窗口便可看到如下图信息:
整个程序的json代码如下:
[{“id”:”f74d6623.08b298″,”type”:”add-strings”,”z”:”b4680211.4b98″,”name”:””,”prepend”:”Hi,”,”append”:” have you ever missed me?”,”x”:399,”y”:354,”wires”:[[“8062ac74.7f9d5”]]},{“id”:”8062ac74.7f9d5″,”type”:”debug”,”z”:”b4680211.4b98″,”name”:””,”active”:true,”console”:”false”,”complete”:”false”,”x”:577,”y”:354,”wires”:[]},{“id”:”3a253531.c5daca”,”type”:”inject”,”z”:”b4680211.4b98″,”name”:””,”topic”:””,”payload”:” I miss you!”,”payloadType”:”string”,”repeat”:””,”crontab”:””,”once”:false,”x”:224,”y”:354,”wires”:[[“f74d6623.08b298”]]}]