ACTIVE SERVER PAGE > function 예제 - 특수문자 존재 체크
등록일 : 2017-07-03 20:20
조회수 : 68,562
str="aaaaa'b%"
str_chk=checkSpecialChar(str)
if str_chk="O" then
response.write " 특수문자가 있습니다. "
else
response.write " 특수문자가 없습니다. "
end if
Function checkSpecialChar(expression)
checkSpecialChar="O"
strSpecial = "`~!@#$%^&*()_+|\;\\/:=-<>.'\ "
For i=1 to Len(expression)
For j=1 to Len(strSpecial)
if mid(expression,i,1)=mid(strSpecial,j,1) then
checkSpecialChar="X"
end if
next
Next
End Function
위의 예문은 특수문자를 체크하는 모듈입니다.
아래 소스는 게시판 글쓰기에서 특수문자 변환 Function 입니다.
Function CheckWord(CheckValue)
CheckValue = replace(CheckValue, "&" , "&")
CheckValue = replace(CheckValue, "<", "<")
CheckValue = replace(CheckValue, ">", ">")
CheckValue = replace(CheckValue, "'", "''")
CheckWord = CheckValue
End Function