(adsbygoogle = window.adsbygoogle || []).push({}); O_o :: '문자열' 태그의 글 목록

'문자열'에 해당되는 글 1건

  1. 2008.11.17 VB 문자열을 원하는 길이만큼 자르기

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

And
prev | 1 | next