怎样验证字符串是否包含有效字符?
人气:0<%
FUNCTION TestString(SomeString)
TempString = trIM(SomeString)
TempString_Length = Len(TempString)
TempString_OK = true
FOR TempString_Pos = 1 TO TempString_Length
TempString_Char = Mid(TempString,TempString_Pos)
TempString_Char_Ansi = Asc(TempString_Char)
IF TempString_Char_Ansi > 47 AND TempString_Char_Ansi < 123 THEN<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
' ANSI字符中:A-Z 是65-90,a-z是97-122,0-9是48-57
IF TempString_Char_Ansi > 57 AND TempString_Char_Ansi < 65 THEN
TempString_OK = False
EXIT FOR
END IF
IF TempString_Char_Ansi > 90 AND TempString_Char_Ansi < 97 THEN
TempString_OK = False
EXIT FOR
END IF
ELSE
TempString_OK = False
EXIT FOR
END IF
NEXT
TestString = TempString_OK
END FUNCTION
%>
加载全部内容