Problem replacing (getting rid of) the dollar sign in an input string.

One Star

Problem replacing (getting rid of) the dollar sign in an input string.

Bonjour,
I have an input data file that looks like this:
Amount Date Type Memo Payee Name
$3,044.18 6/11/2009 12:00:00 PM CREDIT IDSL Dépôt au comptoir/CP SAINT-ANDRE
-$100.00 6/11/2009 12:00:00 PM DEBIT IRSL Retrait au comptoir/CP SAINT-AND
The problem I have is that I want to get rid of the "$" in the Amount column which I process as a string.
Note: I put "+++" to illustrate what happens to the $ after the output. In reality I want to get rid of the $ so I have either a negative or a positive number.
In my tMap component I put the following expression:
StringHandling.CHANGE(row1.Amount,"$","+++")
Here's the output for after processing that column:
$3,044.18+++
-$100.00+++
I also tried: StringHandling.EREPLACE(row1.Amount,"$","+++") and got the exact same output.
I understand that $ in a regular expression means the last character of the string but in these StringHangling functions (CHANGE and EREPLACE) I would expect the output to be:
+++3,044.18
-+++100.00
Is there I else I should do with the CHANGE function?
Thanks.
PM
Community Manager

Re: Problem replacing (getting rid of) the dollar sign in an input string.

Hello guy
try
row1.name.replaceAll("\\$","")

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business