cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for replacing special or junk characters

Former Member
0 Kudos

Hi

Is there any stanard function for replacing any junk characters with zero? If not, I needed UDF for fulfilling this requirement.

My requirment is .... Am sending some files to r/3 using XI. In the source(txt file) some time some fields have some junk characters. I must make it to zero, the field which has junk. How can I acheive it? is there any UDF using which I can fulfill my requiremnt.

Thanks.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Use this UDF

Here a is the input value.

String b = "";

b = a.replaceAll(",", "0");

b = a.replaceAll("@", "0");

Like all the special characters you can take and replace with zero.

...........

return b;

Or

Use the regular expression to check whether special characters occurs in the string then replace with zero

http://www.j2ee.me/developer/technicalArticles/releases/1.4regex/

Regards

Ramesh.

Former Member
0 Kudos

Venkat solution has worked.

Former Member
0 Kudos

Hi,

What do you mean by junk characters? Which character set is the source data using?

Thanks,

-Russ