Remove the zero from the end of a number

Hello,

I have numbers like 1878.90, 1476.20, 1834.620
I want to remove the last zeros and get the ouput as 1878.9, 1476.2, 1834.62.
How do i get this?

1 Like

What is your variable type for the values like 1878.90?

use Trimend if you want to remove the last digit alone

@Priyanka_Ramesh
Its string

@AditiGandhi

text = your_Variable

use this text.Remove(text.Length-1)

Hi @AditiGandhi

Use Substring and the delimited is comma then pass it to array then loop every index and use the Remove method of the string.

cheers :smiley:

Happy learning :smiley:

2 Likes

@AditiGandhi - You can use the Math.Round (232.25324, 1)
It will round the value and return the respective/eligible value.
For value - 232.25324
Output will be = 232.3


If its a string = convert to decimal like
Convert.ToDouble(“232.25324”)
and apply the round function.