Solved

removing everything after a decimal point

Posted on 2004-08-25
11
122 Views
Last Modified: 2013-12-24
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
0
Comment
Question by:bluskyGuy
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 21

Accepted Solution

by:
pinaldave earned 300 total points
ID: 11897327
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
 
LVL 17

Expert Comment

by:Tacobell777
ID: 11897775
#numberFormat("10.00", "________")#

is a better option, the data is not a list but a number..
0
 
LVL 21

Expert Comment

by:pinaldave
ID: 11897794
Hi bluskyGuy,
I will suggest to use suggestion of Tacobell as that is correct. Thanks buddy!

Regards,
---Pinal
0
 
LVL 17

Expert Comment

by:anandkp
ID: 11899664
Try Fix() Or Int() functions available in CF

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

as simple as it can be :)
0
 

Author Comment

by:bluskyGuy
ID: 11910481
Thanks all! First suggestion worked!
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 21

Expert Comment

by:pinaldave
ID: 11918681
Hi bluskyGuy,
glad to help you.
if you do not need any more help you can close the question.

Regards,
---Pinal
0
 
LVL 18

Assisted Solution

by:Plucka
Plucka earned 200 total points
ID: 11962889
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
 
LVL 17

Expert Comment

by:anandkp
ID: 11970371
Hey Plucka - nice to know that u agree with me :)
0
 
LVL 18

Expert Comment

by:Plucka
ID: 12033985
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
 
LVL 17

Expert Comment

by:anandkp
ID: 12041298
WEIRD !!!

[totally agree with u Plucka ... cheers mate]
0
 

Author Comment

by:bluskyGuy
ID: 12041401
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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now