R
RichW
Hi,
I'm writing a program that has got a bit of maths in it. I perform a
division and then end up with something like 2.50, or 3.87, or 4.9975
(ie. y.12345).
I need to get rid of anything in front of the decimal point so that
I'm just left with the bit after the decimal point, ie. 0.50, 0.87,
0.9975, 0.12345 for the examples above.
I can't find the function/method I need to do this. I've spent a
considerable time looking and haven't got much more time to be able to
spend on this. I know this is a basic thing to want to do because I
remember it being on my calculator from my schooldays!
In desperation, I'm now considering converting the value (ie. 3.87) to
a string, and then doing a regex thing to remove anything before the
decimal point, adding a 0 to the start of the string, and then
converting it back to a number.
Please can someone suggest the best way to achieve what I need to do.
(I'm sure it must be because I'm overlooking something simple!).
Thanks very much in anticipation.
Best wishes,
Rich
I'm writing a program that has got a bit of maths in it. I perform a
division and then end up with something like 2.50, or 3.87, or 4.9975
(ie. y.12345).
I need to get rid of anything in front of the decimal point so that
I'm just left with the bit after the decimal point, ie. 0.50, 0.87,
0.9975, 0.12345 for the examples above.
I can't find the function/method I need to do this. I've spent a
considerable time looking and haven't got much more time to be able to
spend on this. I know this is a basic thing to want to do because I
remember it being on my calculator from my schooldays!
In desperation, I'm now considering converting the value (ie. 3.87) to
a string, and then doing a regex thing to remove anything before the
decimal point, adding a 0 to the start of the string, and then
converting it back to a number.
Please can someone suggest the best way to achieve what I need to do.
(I'm sure it must be because I'm overlooking something simple!).
Thanks very much in anticipation.
Best wishes,
Rich