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/
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
Six 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)

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog