<% function stringCount(strString)
dim intPos, chrTemp, intLength '문자열 길이 초기화 intLength = 0
intPos = 1 '문자열 길이만큼 돈다 while ( intPos <= Len( strString ) )
'문자열을 한문자씩 비교한다 chrTemp = ASC(Mid( strString, intPos, 1))
if chrTemp < 0 then '음수값(-)이 나오면 한글임 intLength = intLength + 2 '한글일 경우 2바이트를 더한다 else intLength = intLength + 1 '한글이 아닐경우 1바이트를 더한다 end If
intPos = intPos + 1 wend
stringCount = intLength
end function
Response.Write stringCount("이글의 문자열 길이는?") %>
|
|
|