EasyCFM.COM ColdFusion Forums / Coding Help! / int() problem

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: int() problem

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

chhchung
11-29-2004 @ 10:30 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 268
Joined: Jul 2003

I want to change the decimal number(38.0) to whole number (38), however, the code #int(decimalnum)# doesn't work when the decimalnum is null.

Is that anyway that i can avoid the error when decimalnum is null.  Just give me a blank that's all.

Picture of the day


This message was edited by chhchung on 11-29-04 @ 12:49 PM

maquiladoras
11-29-2004 @ 10:58 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 2073
Joined: Dec 2002

why not just use round() ?
or are you saying you want decimal places unless they end in .0?

-
"There is no justice, There is Just Us"
-

chhchung
11-29-2004 @ 11:22 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 268
Joined: Jul 2003

The number display in my site is end with .0 if the number is whole number.

Maybe the problem with access db.  If db is empty, when you use int() it giving error. I want to avoid it.

This message was edited by chhchung on 11-29-04 @ 12:48 PM

studio
12-02-2004 @ 1:06 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 22
Joined: May 2004

if (len(decimalnum)){
   result = int(decimalnum);
}

Sponsored By...
iOpenSoft, LLC is a Houston, Texas Advanced Technology Studio Specializing in Web Design, Web Development, iPhone App Development and Android App Development.