IsNumeric problem....

S

Steven Burn

Anyone have any why the following, returns true?

'// Leave everything after the ?
strTemp = StripQStr("/?DD0898SDFSDFSD89Q2ASD8822")

If IsNumeric(StrTemp) Then
Response.Write strTemp & " is numeric"
else
Response.Write strTemp & " is not numeric"
end if

'// Function to strip everything upto and including the "?"
'// and return only the string after it.

Function StripQStr(strVal)
Dim path
path = Split(strVal, "?")
StripQStr = path(UBound(path))
End Function

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
R

Ray at

Do you have your computer plugged in with the outlet upside down? It
doesn't return true for me!

XP Pro, WSH 5.6.

Ray at home
 
S

Steven Burn

hehe, not quite........

Basically what is happening is, I've got URL's stored in a database, e.g.;

http://<domain>/?querystring (alphanumeric)

I use the function I mentioned, to strip the querystring so I can check that
it contains only numeric characters. So for example;

'// This should return true
http://<domain>/?12345

'// should return false
http://<domain>/?AA4556FF354DSF723

I'm pulling the fields from the database using;

Do Until rst.eof
If rst("URL")=strTemp Then
If IsNumeric(StripQStr(rst("QS"))) Then
TheFunction = True
Exit Do
Else
'// Nothing (if it's false, I don't want to know
'// about it as the script will only process
'// when it is false)
End If
End if
rst.movenext
Loop

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
S

Steven Burn

I should have added, the server is running on Windows 2000 and AFAIK, has
WSH 5.6 (it's not my server and the info isn't available, so don't know for
sure which version is running........)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 
R

Ray at

Is there more to it than that? Is there anything that's giving a value to
the function before the loop? What about:

Do Until rst.eof
If rst("URL")=strTemp Then
RESPONSE.WRITE rst("QS") & ": "
If IsNumeric(StripQStr(rst("QS"))) Then
TheFunction = True
'Exit Do let's not exit while testing
RESPONSE.WRITE "TRUE<BR>"
Else
'// Nothing (if it's false, I don't want to know
'// about it as the script will only process
'// when it is false)
RESPONSE.WRITE "FALSE<BR>"
End If
End if
rst.movenext
Loop

RESPONSE.END


Ray at home
 
S

Steven Burn

strTemp is just a regular URL (i.e. domain.com/page.html), that part works
fine.

I've just done a response.write and figured out where it was going wrong.

It was finding the first match only, and regardless of whether it was
numeric or not, was returning the boolean.

cheers Ray ;o)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

use the oleDBCommand in ASP 2
file rename Problem in asp upload 1
OT - sending HTML email 2
Replace Function 6
Form Results 4
Reverse text 78
Response. and Request. 2
Block "HEAD" method? 2

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,072
Latest member
trafficcone

Latest Threads

Top