Skip to content

Instantly share code, notes, and snippets.

@mingtsay
Created May 1, 2011 11:03
Show Gist options
  • Save mingtsay/950420 to your computer and use it in GitHub Desktop.
Save mingtsay/950420 to your computer and use it in GitHub Desktop.
vb.net function check name
function 檢查姓名(byval 姓名 as string) as boolean
dim 檢查 as boolean
for i as integer = 1 to len(姓名)
檢查 = false
select case lcase(mid(姓名, i, 1))
case "0"
case "1"
case "2"
case "3"
case "4"
case "5"
case "6"
case "7"
case "8"
case "9"
case "a"
case "b"
case "c"
case "d"
case "e"
case "f"
case "g"
case "h"
case "i"
case "j"
case "k"
case "l"
case "m"
case "n"
case "o"
case "p"
case "q"
case "r"
case "s"
case "t"
case "u"
case "v"
case "w"
case "x"
case "y"
case "z"
case "~"
case "!"
case "@"
case "#"
case "$"
case "%"
case "^"
case "&"
case "*"
case "("
case ")"
case "_"
case "+"
case "|"
case "`"
case "-"
case "="
case "\"
case "["
case "]"
case ";"
case ":"
case "'"
case """"
case ","
case "."
case "/"
case "<"
case ">"
case "?"
case else
檢查 = true
end select
if not 檢查 then
檢查姓名 = false
exit function
end if
next i
檢查姓名 = true
end function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment