Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select case statement 1

Status
Not open for further replies.

Johnnie100

Programmer
Dec 8, 2000
31
GB
I am using the select case statement and moved some code over from a VB app to an ASP class and the select case statement seems to operate differently - giving me a run time error for the statement below - can I code something similar in VBScript? I have looked on the net and in various books but all I can find is the very basic of examples that do not cover what I'm looking for!

I have coded;

Select Case Mid(Str, i, 1)
Case "a" To "z", "A" To "Z", "0" To "9", " "

Thanks
 
Ranges don't work. Try this neat trick I learned from Tarwn..

val = Mid(Str, i, 1)
SELECT CASE true
case (val >= &quot;a&quot; and val <= &quot;z&quot;) OR (val>= &quot;A&quot; and val <= &quot;Z&quot;) OR (val >= &quot;0&quot; and val <= &quot;9&quot;) or val = &quot; &quot;



you might also want ot research regular expressions...
Get the Best Answers! faq333-2924
Is this an asp FAQ? faq333-3048
Tek-Tips Best Practices: FAQ183-3179
It's sad that some Americans proudly turn their backs on the very Flag the gives them the opportunity to do just that... - Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top