cancel
Showing results for 
Search instead for 
Did you mean: 

UDF to Remove Trailing Zeros from string

manemahesh
Participant
0 Kudos

Hi All,

I need UDF to remove trailing zeros from string and these zeros are not fixed they are dynamic.

e.g.String is like 12036000 so output should be like 12036.

Please help.

Accepted Solutions (1)

Accepted Solutions (1)

manemahesh
Participant
0 Kudos

Thanks karthik

Above piece of code works fine.

KarthikBangeraM
Active Participant
0 Kudos

Good to know Mahesh!

Former Member
0 Kudos

Hi Mahesh,

Glad to know that your issue is resolved. Click on the correct answer and close the thread.

It is helpful for other users.

Regards,

Suhale Shaik.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Experts,

I need UDF for below

e.g.String

If  input is 12,00 so output should be like 12

If Input is 12,01 so output should be like 12,01

Please help.

Aarti

anupam_ghosh2
Active Contributor
0 Kudos

Hi Aarti,

               Please can you open a new thread.

This is a closed discussion.

Regards

Anupam

Former Member
0 Kudos

done!!

Former Member
0 Kudos

Hi Mahesh,

You should mark Karthik's answer as right one but not mine. Please correct it.

Regards,

Suhale Shaik.

KarthikBangeraM
Active Participant
0 Kudos

Hi Mahesh,

You can use the below piece of code-

public String removeTrailingZeros(String var, Container container) throws StreamTransformationException

    {

        return var.replaceAll("0*$", "");       

    }

Regards,

Karthik