Android Question Clear decimal number ?

G-ShadoW

Active Member
Licensed User
Hello, how to remove all numbers after . (dot)
decimal numbers
234.32165735436
12.685633468587979 etc

so that I get clean number

234
12
 

JTmartins

Active Member
Licensed User
You have other options depending on the situation.

One is taking advantage of B4A cast

example

B4X:
Private a As Float
Private b As Int
a=12.233233
b=a
in the above situation b will hold the integer part of a

The other is using the keyword Floor

Example
B4X:
Private X As Float
X=12.233233
X= (Floor(X))
Log (X)
In the end X will hold the integer part of the initial X value

and of course you also have the numberformat2 option.
 
Top