how to delete blank spaces in 1 string (talend open studio)

One Star

how to delete blank spaces in 1 string (talend open studio)

Hello
I have an error message "for input string: 14 789" when i would like transfer 1 file .csv to a table mysql.
I used Treplace ( replace " " with "") et tmap (StringHandling.EREPLACE(row1.Montant,"\\s","")
but my pbroblem always exists .
Thanks
Tha
Moderator

Re: how to delete blank spaces in 1 string (talend open studio)

Hi,
There is also an option "Trim all columns" in Advanced Settings of tFileInputDelimited component.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: how to delete blank spaces in 1 string (talend open studio)

Hi Tha
Just try this code in tJava and apply at rowlevel if you are using file component
String foo = " 14 789";
System.out.println("value = "+foo.replace(" ", ""));
System.out.println("value = "+foo.replaceAll("\\s", ""));

thanks
Anil Kumar Burri
http://anilkumarburri.wordpress.com/
Highlighted
One Star

Re: how to delete blank spaces in 1 string (talend open studio)

Hi,
Tk your solutions.
I tried your both 2 solutions: code java and "Trim all columns" in Advanced Settings of tFileInputDelimited. But no success.
For anilmca4u, there are 200 different lines "for input string" avec 200 values when i run my jobs:
For input string: "2 725"
For input string: "2 725"
For input string: "2 725"
For input string: "2 725"
For input string: "12 489"
For input string: "12 489"
For input string: "12 489"
For input string: "12 489"
For input string: "1 050" ...
TKs
Tha
Five Stars

Re: how to delete blank spaces in 1 string (talend open studio)

String foo = "2 725".replaceAll(" ", "");
Hope this will work for you..
One Star

Re: how to delete blank spaces in 1 string (talend open studio)

For umeshrakhe,
It didn't work. Sorry
Four Stars

Re: how to delete blank spaces in 1 string (talend open studio)

Hi Tha
Sorry but for me it is working fine for every value u given, for your reference find the screen shot

thanks
Anil Kumar Burri
http://anilkumarburri.wordpress.com/
Seven Stars

Re: how to delete blank spaces in 1 string (talend open studio)