removing everything after a decimal point

Hi all,
Quick question...how would I go about removing everything after a decimal point is encountered using CF?

Basically I have a value being returned from a query that is in floating point form, ie: 10.0
I need to only display this variable's whole number, ie: 10

How would I go about doing this?

Thanks,
Rick
bluskyGuyAsked:
Who is Participating?
 
pinaldaveConnect With a Mentor Commented:
Hi bluskyGuy,
Hi bluskyGuy,
listfirst(yourstring,'.')
should do the work.

Regards,
---Pinal

===================================================================
 Comment from pinaldave                    08/25/2004 02:03PM
===================================================================
Hi mostym,
<cfset YourList = "element1,element2,element3">


<cfoutput>
#ListFirst(YourList)#
</cfoutput>

you can do something like that... and if you have different delim then you can specify them in your string
Name: ListFirst()
Usage: ListFirst(list [, delimiters ])
Description: ListFirst() will return the first element in your list.

Regards,
---Pinal


Regards,
---Pinal
0
 
Tacobell777Commented:
#numberFormat("10.00", "________")#

is a better option, the data is not a list but a number..
0
 
pinaldaveCommented:
Hi bluskyGuy,
I will suggest to use suggestion of Tacobell as that is correct. Thanks buddy!

Regards,
---Pinal
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
anandkpCommented:
Try Fix() Or Int() functions available in CF

<CFOUTPUT>
#fix(10.00)#
#int(10.00)#
</CFOUTPUT>

as simple as it can be :)
0
 
bluskyGuyAuthor Commented:
Thanks all! First suggestion worked!
0
 
pinaldaveCommented:
Hi bluskyGuy,
glad to help you.
if you do not need any more help you can close the question.

Regards,
---Pinal
0
 
PluckaConnect With a Mentor Commented:
Hi pinaldave,

Umm, there is a function for this, int take the integer portion of a number, ie drop the decimals, no reason to treat this as a list.

<cfset value="10.25" />
<cfoutput>#int(value)#</cfoutput>

Regards
Plucka
0
 
anandkpCommented:
Hey Plucka - nice to know that u agree with me :)
0
 
PluckaCommented:
anandkp,

Really if he agrees this is a good solution then you should have gotten the points. I think to often people just accept the first answer that works, regardless if it's the best answer.

I was just pointing out after he said the first solution worked that this wasn't the best solution.

Regards
Plucka
0
 
anandkpCommented:
WEIRD !!!

[totally agree with u Plucka ... cheers mate]
0
 
bluskyGuyAuthor Commented:
hi guys,
yea, I was just looking for speed-to-solution....i needed a solution ASAP although it necessarily wasn't the best solution.
Thanks,
bluskyguy
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.