How to delete zeros from the front of a number?

maths.ephhk shared this question 2 years ago
Answered

I use an inputbox to get a number in string. e.g. value = "0000234560"

I want to remove the first 4 zeros, so that value = "234560"

But my following code doesn't work. I need some help.

SetValue(loopnum, Length(value))

Repeat(loopnum, If(IndexOf("0", value)==1, SetValue(value, Take(value, 2)) ) )


I am wondering is the dependencies problem or what? Thanks you for your help.

Comments (3)

photo
1

My case is when the user input any numbers with 0's in front, my code will always erase the 0's in front.

Hope someone can help. Thanks

photo
2

You can use the script command ParseToNumber()

photo
1

Thanks for your idea~Thats what I want~!

© 2023 International GeoGebra Institute