IsState Function:

The IsState function checks a two-letter string against all valid postal abbreviations for US States. There are currently 51 (including DC) state abbreviations recognized by IsState. IsState returns true if a state abbreviation is valid or False if the abbreviation is unknown.

Syntax:
boolean = IsState(stateabbr)
Example Usage:
<%
 ' IsState returns true
response.write IsState("NY") & "<BR>"
response.write IsState("ca") & "<BR>"
response.write IsState("Az") & "<BR>"

 ' IsState returns False
response.write IsState("NYC") & "<BR>"
response.write IsState("PE") & "<BR>"
response.write IsState("horse") & "<BR>"
response.write IsState(22) & "<BR>"
%>
ASP Source Code:
<%
Private Function IsState(byVal stateabbr)
	If Len( stateabbr ) <> 2 Then
		IsState = False
		Exit Function
	ElseIf IsNull( stateabbr ) Then
		IsState = False
		Exit Function
	ElseIf IsEmpty( stateabbr ) Then
		IsState = False
		Exit Function
	ElseIf IsNumeric( stateabbr ) Then
		IsState = False
		Exit Function
	Else
		stateabbr = CStr( stateabbr )
		Select Case UCase(stateabbr)
			Case "AL", "AK", "AZ", "AR", "CA", _
			     "CO", "CT", "DE", "DC", "FL", _
			     "GA", "HI", "ID", "IL", "IN", _
			     "IA", "KS", "KY", "LA", "ME", _
			     "MD", "MA", "MI", "MN", "MS", _
			     "MO", "MT", "NE", "NV", "NH", _
			     "NJ", "NM", "NY", "NC", "ND", _
			     "OH", "OK", "OR", "PA", "RI", _
			     "SC", "SD", "TN", "TX", "UT", _
			     "VT", "VA", "WA", "WV", "WI", _
			     "WY"
				IsState = True
				Exit Function
			Case Else
				IsState = False
				Exit Function
		End Select
	End If
End Function
%>