안규 공부방

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



 
※ 혹시 도움이 되셨다면 댓글에 한마디 남겨주세요!
작성자   비밀번호
자동글 방지     (자동글 방지 기능입니다.)
내용   댓글달기 
이메일 문의 : cak0280@nate.com  
Copyright 2000 By ENTERSOFT.KR All Rights Reserved.