Negative sign at the end

Hi,

First I’m a very beginner, so sorry if my question is super basic…

I have an extract (a TXT, comma-separated) in which all numbers are stored in a strange way… the negative sign is at the end of the number (example 100.0-).

I don’t know how to transform it. I would like to do a “string manipulation”, replace (string, * -, - *) with * as a wildcard, but it doesn’t work - probably because of a wrong syntax…

After that I want to transform it to a double.

Do you have an advice ??

Thank you.

Laurent

Hi @Zarkoff95 -

Here’s one way you could do it. I’m sure there’s a more elegant way, but this may illustrate for you the use of some nodes you’re not familiar with.

2020-01-03%2013_57_21-KNIME%20Analytics%20Platform

2020-01-03%2013_57_29-Output%20data%20-%202_258%20-%20Math%20Formula%20(Multiply%20for)

Reformat_Negative_Number_Strings.knwf (12.4 KB)

Thank you, that’s very smart !
My main problem is that I have the Excel way-of-thinking, and never think to create columns to sequence the transformation.

Hi have the same problem. Maybe, in the “string to number” node, an option to recognize negative sign at the end could be useful

Hi @massic,

welcome to KNIME Community!

I would prefer having this read with a reader node as a number but maybe having this option in String to Number node isn’t bad idea.

Will forward it.

EDIT: Ticket for enhancement created.

Br,
Ivan