Highlighted
Six Stars

Data Cleansing

Hi,

Apologies if it sounds a stupid question. I need to do data cleaning as below

Original DataTransformed Data expected
MAY 1000394MAY1000394(remove spaces and convert to UpperCase)
MAY 73-4506MAY73-4506(remove spaces and convert to UpperCase)
MAY v 1915MAYV1915(remove spaces and convert to UpperCase)
MAY-P8181MAYP8181(and convert to UpperCase, also remove '-' after MAY)

 

please help out with a solution

 

Regards,

Meena

1 ACCEPTED SOLUTION

Accepted Solutions
Five Stars

Re: Data Cleansing

Here is the solution in a tMAP

Capture.PNG

Here is the code: in.originalData.trim().replace(" ","").replace("MAY-","MAY").toUpperCase()

Is that what you need?

 

EDIT: better do this in this way : in.originalData.trim().replace(" ","").toUpperCase().replace("MAY-","MAY")

3 REPLIES
Seven Stars

Re: Data Cleansing

@muralam - is this the complete data set or these are few samples. The reason to know if the data & the "-" are in fixed positions, or variable.

Five Stars

Re: Data Cleansing

Here is the solution in a tMAP

Capture.PNG

Here is the code: in.originalData.trim().replace(" ","").replace("MAY-","MAY").toUpperCase()

Is that what you need?

 

EDIT: better do this in this way : in.originalData.trim().replace(" ","").toUpperCase().replace("MAY-","MAY")

Six Stars

Re: Data Cleansing

Thanks for your prompt response, its working