var newMsg = { payload: msg.payload.split(":")[1]};
var newMsg2 = newMsg.trim();
return newMsg2;
var newMsg = { payload: msg.payload.split(":")[1]};
--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
STATUS: 200
HEADERS: {"date":"Tue, 19 May 2015 18:04:38
GMT","server":"Apache","accept-ranges":"bytes","vary":"Accept-Charset,Accept-Encoding,Accept-Language,Accept","access-control-allow-origin":"*","access-control-allow-methods":"GET,
PUT, POST, DELETE, OPTIONS","access-control-allow-headers":"accept,
origin, x-requested-with,
content-type","access-control-max-age":"86400","content-length":"0","access-control-allow-credentials":"true","keep-alive":"timeout=15,
max=1000","connection":"Keep-Alive","content-type":"application/json;charset=UTF-8"}
--
Nicks regex assumes there is always a space before a number... If it's 10 or more is that true ? (Or is it only true under 10 ?)
You could try
msg.payload = parseFloat(msg.payload.split(":")[1]);
return msg;
/\:\s*(.*)\s*$/
--
Julian,
ParseFloat tries to look for numbers and will handle whitespace just fine. No need to trim.
+1. We've all been there !