Android Question Clear decimal number ?

Discussion in 'Android Questions' started by G-ShadoW, May 12, 2015.

  1. G-ShadoW

    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
     
  2. G-ShadoW

    G-ShadoW Active Member Licensed User

    ok, I got it NumberFormat2
     
  3. JTmartins

    JTmartins Active Member Licensed User

    You have other options depending on the situation.

    One is taking advantage of B4A cast

    example

    Code:
    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
    Code:
    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.
     
    RandomCoder and DonManfred like this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice