#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2002
    Posts
    259
    Rep Power
    13

    Change Data Type?


    How do you change the data type? I need to change a int to a boolean.
  2. #2
  3. No Profile Picture
    Moderator =(8^(|)
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2002
    Location
    Sacramento, CA
    Posts
    1,710
    Rep Power
    14
    You can't directly. Try something like:
    Code:
    my_bool = !( new Integer( my_int ).equals( new Integer( 0 ) ) );
    or, probably faster:
    Code:
    my_bool = my_int > 0 ? true : false;

IMN logo majestic logo threadwatch logo seochat tools logo