Delete all characters from the last space

Hi!

is it possible to delete all characters from the last space?

Here's an example.

O ring set IFW140-05
Flywheel Tapered Collet Set IFW143B
Shock Boots IFW154

and this is what it should look like when it's done.

IFW140-05
IFW143B
IFW154

Hi @madmax !
Using a function node assuming each string arrives separately as a msg.payload, you could split each string to an array and then return the last element of the array:

let productArray = msg.payload.split(" ")
let productID = productArray[productArray.length - 1]
msg.payload = productID
return msg
1 Like

Hi!

Many many thanks. Goes great

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.