function to convert pounds and pence to pence

pb21

Registered User.
Local time
Today, 15:49
Joined
Nov 2, 2004
Messages
122
Hi I need to write a function to convert pounds and pence to all pence. so therefore £10.55 becomes 1055 or £1.55 becomes 155. The function will not know if the number has a negative sign in front £-1.55 so it needs to allow for that so how do I get the digits only from the left and right of decimal points?

regards in advance
peter
 
dim intvalue as long

'ignore formatting, just thing about the number. if you have more than 2dps you will get some rounding issues but

intvalue=currencyvalue*100

there is a maximum intvalue, 2^64 I think, but probably ok below billions of pounds

any negative will be handled automatically
 

Users who are viewing this thread

Back
Top Bottom