Move last character to the beginning

Hi guys, I need to convert a string cell to number (is actually a double). However, the minus symbol is at the end of the string, and the node fails. I should first put the minus sign at the beginning and afterwards run the node, or use an alternative, maybe with the string manipulation node.

Captura

which is the fast way to do this operation? I have a huge data set, and performance is an issue. Thanks.

Hi @Sgomezba

The -String Manipulator- node is quite fast. I would suggest the following instruction:

join( string( substr( "-", 1 - count( $ImpteNeto$, "-"), 1)), removeChars( $ImpteNeto$, "-"))

Just copy & paste the previous instruction into a -String Manipulation- node and replace the name of the column to correspond to your column name.

It moves the “minus” sign from the end of a string right to the beginning:

image

Hope it helps.

Best
Ael

6 Likes

thank you so much @aworker, it’s works perfect!!

2 Likes

My pleasure @Sgomezba. Glad it worked and thank you for validating the solution.

Best wishes,
Ael

1 Like

Hello @Sgomezba,

here you’ll find a regex solution (@aworker created workflow :sweat_smile:) plus there’s a ticket to add this feature into String to Number node.

Br,
Ivan

1 Like

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