'자르기'에 해당되는 글 1건
- 2008.11.17 VB 문자열을 원하는 길이만큼 자르기
' --------------------------------------------------------
' 문자열을 원하는 길이만큼 자르기
' --------------------------------------------------------
function cutstr(long_str, cutting_len)
dim i, short_str, tail
tail = "..."
long_str = trim(long_str)
for i = 0 to cutting_len-1
if asc(mid(long_str, i+1, 1)) >= 128 then
kor = kor + 1
else
eng = eng + 1
end if
next
if len(long_str) > cutting_len then
if kor mod 2 = 1 then
cutting_len = cutting_len - 1
end if
short_str = mid(long_str, 1, cutting_len)
cutstr = short_str & tail
else
short_str = mid(long_str, 1, cutting_len)
cutstr = short_str
end if
end function