본문으로 바로가기

ASP 문자열 자르기

category 웹/웹.php.asp 2008. 2. 27. 12:08

function cutString(tStr,length)
  dim i,j
  j = 0
 

  for i = 1 to len(tStr)
   if (asc(mid(tStr,i,1))<0) then
    j = j + 2
   else
    j = j + 1
   end if

   if (j > (length)) then
    cutString = left(tStr,i-2) & ".."
    exit function
   end if
  next


  cutString = tStr
end function