PDA

Click to See Complete Forum and Search --> : IsNumber ???


Andy Collyer
Dec 1st, 1999, 09:23 PM
Can't find this anywhere - is there a way of checking that a string contains just digits and can therefore be converted to an integer before trying it? I thought there was an IsNumber function but evidently not. Am I just looking for the wrong thing?

TIA,

AndyC
London

MR
Dec 1st, 1999, 09:35 PM
I beleive what your looking for is the isnumeric() function.

Kiron
Dec 1st, 1999, 09:46 PM
The function you looking for is IsNumeric(x) function but if later you try to convert number like 12.3 to integer it will the function

Dim int As Integer
Dim str As String
str = "12.3"
if IsNumeric(str) Then int = CInt(str)
int will be 12

Try it.

[This message has been edited by Kiron (edited 12-02-1999).]

Andy Collyer
Dec 1st, 1999, 09:53 PM
IsNumeric! How close!

Thanks all - yes, I was just being thick :)

AndyC

Rose
Dec 1st, 1999, 10:04 PM
You are looking for the Isnumeric function. It is used for converting between string and numbers. It also returns true if a string can represent a number.
i.e. 1 = 1
-1 = -1

ROSE

Rose
Dec 1st, 1999, 10:13 PM
Andy
Oh, you just got it before you read my reply.

My connection is very slow....

ROSE