Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I remove a decimal point in value?

0 views
Skip to first unread message

Drew

unread,
Oct 7, 2003, 4:53:11 PM10/7/03
to

Hi,

I'm trying to take this value 0.85 and turn it into 85, or 1.35 and
turn that into 135.

The values start off as 254.499999784 and 300, next is
#DecimalFormat(FTime/HRGoal)# and it comes out to 0.85.

One path I tried was replace, to remove the decimal but I was hoping
there was a parameter in DecimalFormat to move the decimal all the way
to right or better yet, just remove completely .. but keep the
displayed value?

Any ideas?

thnx

Charlie Griefer

unread,
Oct 7, 2003, 5:05:43 PM10/7/03
to
so you have...

<cfset foo = decimalFormat(ftime/hrgoal)>

and in this case, 'foo' is 0.85.

if the number will always be using the decimalFormat() function, there will
always be 2 decimal places, which means you can simply multiply the value *
100.

<cfset foo = decimalFormat(ftime/hrgoal)>
<cfset whole_foo = foo * 100>

hth,
charlie

"Drew" <B...@comcast.net> wrote in message
news:vi96ov4sn9mc51fnk...@4ax.com...

Cletus Lee

unread,
Oct 7, 2003, 5:24:24 PM10/7/03
to
You can also treat it as a “.” separated list and parse and then concatenate the list members.

In article <HUFgb.64$e86....@news.uswest.net>, cha...@spamcop.com says...

--

Cletus D. Lee
Bacchetta Giro
Lightning Voyager
http://www.clee.org
- Bellaire, TX USA -

"Adam Haskell" <AdamH

unread,
Oct 7, 2003, 5:54:05 PM10/7/03
to
<cfset value=#REreplace(value,'[^0123456789]','','all')#>

That should remove anything this is not a number including decimal points.

Adam


"Drew" <B...@comcast.net> wrote in message
news:vi96ov4sn9mc51fnk...@4ax.com...
>

Joseph Maitino

unread,
Oct 7, 2003, 6:37:36 PM10/7/03
to
sounds like the number will always be betwee 0 and 1.... so your looking
at a percentage... just multply by 100

if you just want to remove the ".' try using the replace command.

"Drew" <B...@comcast.net> wrote in message
news:vi96ov4sn9mc51fnk...@4ax.com...
>

Charlie Griefer

unread,
Oct 8, 2003, 10:48:53 AM10/8/03
to
this is probably overly picky, but I would think that parsing a list (yeah,
i know...it's just 2 elements) and concatenating what are effectively
strings, would be slower versus simply multiplying the current value * 100.

charlie

"Cletus Lee" <New...@clee.org> wrote in message
news:MPG.19eceaffb...@News.Individual.NET...

Cletus Lee

unread,
Oct 8, 2003, 11:29:47 AM10/8/03
to
In article <qtVgb.64$JG4....@news.uswest.net>, cha...@spamcop.com says...

> this is probably overly picky, but I would think that parsing a list (yeah,
> i know...it's just 2 elements) and concatenating what are effectively
> strings, would be slower versus simply multiplying the current value * 100.
>

yes, there are many ways to solve this problem. Using regular expressions are probably the most
efficient. (wish I had thought of it)

--

Cletus D. Lee

Andy J

unread,
Oct 8, 2003, 12:24:10 PM10/8/03
to
Surely the straight replace would work better in this case as you are only
looking for a ".". You dont really need to use the power of RegEx? If
anything i would expect RegEx to slow it down?

Andy J
www.andyjarrett.co.uk


"Cletus Lee" <New...@clee.org> wrote in message

news:MPG.19ede965c...@News.Individual.NET...

Andy J

unread,
Oct 8, 2003, 7:33:31 PM10/8/03
to
Hi, well i had to play and do a few tests. If you just use the replace() and
not reRplace its about 100% faster. Though just doing it on one string
probably wont make much difference. If anyone is interested i have put it on
my site with the results.

--

Andy J
http://www.andyjarrett.co.uk

"Andy J" <awjarrett[at]hotmail[dot]com> wrote in message
news:vo8efna...@corp.supernews.com...

Drew

unread,
Oct 9, 2003, 7:59:48 AM10/9/03
to
thnx for all your help guys, the replace works well
0 new messages