Hi I am having a horrible time with a decimal point problem.
I need all numerical values to be converted to a positive integer.
(i.e. for "19.99" to be converted to "1999")

I need to find a script that will check a numerical value to see if a decimal point is present, and if it is, then to remove it.
Else if no decimal point is originally present then to append "00" to the end of the numerical value.

Our shopping cart uses decimal points but the payment gateway doesnt. Some items may be set with the price 1.25 this needs to be converted to 125, but other prices may be 23 this needs to be converted to 2300.

Please help if you can, as I cant find a script to do this anywhere...
Warm Regards,

12 Years
Discussion Span
Last Post by Dani

Well I need to find a script that will first check to see if there is a decimal point present in the price, and if so, just remove it, else if there is not any decimal point it needs to add the 00 to the end which as you say could be done by multiplying the figure by 100.

But I am not a programmer, I need to find a script that will do this for me.



1.25 x 100 = 125
23 x 100 = 2300
19.99 x 100 = 1999

Whether there is or isn't a decimal place, multiplying by 100 should work. No?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.