working with decimal places

# Thread: working with decimal places

1. Senior Member
Join Date
Dec 1969
Posts
209

## working with decimal places

hi,<BR><BR>i want to identify the two decimal places of a number. they will be either .25 .50 .75 but occurring with a different whole number i.e 1.25, 3.50, 7.75 etc<BR><BR>i wish to do a select case for each one like:<BR><BR>select case point<BR> case 25<BR> take action 1<BR> case 50<BR> take action 2<BR> case 75<BR> take action 3<BR> case 0<BR> take action 4<BR><BR>how can i do this with vbscript?<BR><BR>thanks in advance<BR><BR>gelboe

2. Senior Member
Join Date
Dec 1969
Posts
16,931

## RE: working with decimal places

Why&#039;s this in the regular expressions forum?!<BR><BR>SELECT Case (dblNumber-Int(dblNumber))<BR> Case 0<BR> Case 0.25<BR> Case 0.5<BR> Case 0.75<BR> Case Else<BR>End Select<BR><BR>?? Of course, that&#039;s off the top of my head - you&#039;d have to read the documentation on the Int() function to check that it&#039;d work right with negative numbers etc.<BR><BR>Craig.

3. Senior Member
Join Date
Dec 1969
Posts
11,247

## Untried but give it a shot

select case (point Mod Cint(point))<BR>case .25<BR>take action 1<BR>case .50<BR>take action 2<BR>case .75<BR>take action 3<BR>case else<BR>take action 4

4. Senior Member
Join Date
Dec 1969
Posts
11,247

## Better that Mine I think <nt>

;-)

5. Senior Member
Join Date
Dec 1969
Posts
16,931

## Ack...

...prolly not. Mine&#039;s untested as well, and I doubt you were up until stupid-o-clock last night doing CSS...!<BR><BR>Craig.

6. Senior Member
Join Date
Dec 1969
Posts
11,247

## No I was playing

Baldur&#039;s Gate online...<BR><BR>Allnighter! (Wife&#039;s away!!)

7. Senior Member
Join Date
Dec 1969
Posts
16,931

## Lucky man.

Games, not the other (honest ;-)).<BR><BR>Craig.

8. Senior Member
Join Date
Dec 1969
Posts
209

## cheers guys, gto it working now

&nbsp;<BR><BR>

9. Senior Member
Join Date
Dec 1969
Posts
11,247

## I'm curious

Which way did you go?<BR><BR>Reaperman or Knight?

10. Senior Member
Join Date
Dec 1969
Posts
16,931

## Does it matter?

1001 ways to skin a cat, and yours and mine just involved holding the knife at a different angle.<BR><BR>Craig.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•