how would I do this?
Shak
Printable View
how would I do this?
Shak
VB Code:
Number = 45.235 strnumber = CStr(Number) pos = InStr(strnumber, ".") decimals = Right(strnumber, Len(strnumber) - pos)
If your PC has , as decimal separator (european settings) then put "," instead "." inside InStr
thanks :D
or y=x-int(x)
RobShakir, this is probably a better option because it will be faster becase there are no strings involved. however there are few situation where it will matter. It is only important in loops. Just thought i'd let you know.Quote:
Originally posted by Everso
or y=x-int(x)
thanks :D
I have it now :D
Shak
Both codes are for a different purposeQuote:
Originally posted by Everso
or y=x-int(x)
Using Int
x=43.235
y=0.235
Using strings
x=43.235
y=235
Only one code works depending on what is required
:D good point...Quote:
Originally posted by joijo
Both codes are for a different purpose
Using Int
x=43.235
y=0.235
Using strings
x=43.235
y=235
Only one code works depending on what is required