当前位置: 移动技术网 > IT编程>开发语言>其他编程 > 如何验证字符串是否包含有效字符?

如何验证字符串是否包含有效字符?

2017年12月08日  | 移动技术网IT编程  | 我要评论

<%
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

' ansi字符中:a-z 65-90,a-z97-122,0-948-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
%>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网