How To Delete Number After Fourth Character?

Hi!

I need delete a number after fourth character.
Can someone help me?

Example:

I receive a phone number with value: 553793932345

I need transform to: 55373932345 (without the fifth character).

Thanks for your attention.

If you need this in an expression you could use the JavaScript slice() function to grab the first 4 characters and then another expression to grab the remaining characters after the 5th.

As an example the following would take the input from a webhook GET query of ?input=553793932345 and return 55373932345

{{$node["Webhook"].json["query"]["input"].slice(0,4)}}{{$node["Webhook"].json["query"]["input"].slice(5)}}

GIF

There may be an easier method to do this, but this solution has worked for me in a similar use case.

Reference: String.prototype.slice() - JavaScript | MDN

2 Likes

Oh! This is a good solution! Thank you very much @GlitchWitch! I had tried using Splice, but it didn’t work. Now with this use of Slice it will work perfectly!

1 Like