neilkidds
15th December 2009, 17:06
How to get the first 2 positions of a number whose type is long?
e.g. the number is 123456, I need to get 12 as a result and the type of this result is also long.
Anyone knows? Thanks a lot
bdittmar
15th December 2009, 17:20
How to get the first 2 positions of a number whose type is long?
e.g. the number is 123456, I need to get 12 as a result and the type of this result is also long.
Anyone knows? Thanks a lot
Hello,
convert your long to string with str$(),
read the first two positions of the string variable = string(1;2)
convert string-variable to NUM with lval()
Regards
steveauckly
15th December 2009, 17:43
If you know how long the number is, you could also use division:
[longvariable] = 123456 / 10000
A long divided by a long returns a long so the remainder is truncated.