Remove non applicable zeros in decimal place

I would like to seek advice on how to remove the zeros from a string. Basically the source I get the value from always gives 4 decimal places even if they are all zeros. So I would like to manipulate the data such that if the value is a whole number, remove the ‘.’ and ‘0’ entirely, and if there’s decimal place, remove the ‘0’ after the last sensible digit. Examples as follows:

123.0000 ==> 123
123.4500 ==> 123.45
123.4560 ==> 123.456
123.2080 ==> 123.208

Thank you in advance.

Assign cleanValue = If(value.Contains("."c),Decimal.Parse(value).ToString(“0.####”),Integer.Parse(value).ToString)

try this

Hi you can try this it will remove the zeros a



str = “YourText”



or you can try this


This is already discussed in many post @QTH
Would recommend to have a view on unit

Cheers @QTH