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,
Joseph
www.CharitiesOnline.co.uk
:confused:

What have you tried? Multiplying by "100" would appear to me to be the first step.

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.

Joseph

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.