熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp 中西文混合式字符截取程序

2013-11-13 10:45:54  來源: .NET編程 

  中西文混合式字符截取程序
function CutStr(byVal valbyVal lengthbyVal endStr)
  Dim ltci
  If val = "" Or IsNull(val) Then
   CutStr = ""
   Exit Function
  End If
  If length = "" Or Int(length) <= Or IsNumeric(length) = False Then
   CutStr = val
   Exit Function
  End If
  val = LoseHTML(val)
  l = Len(val)
  length = Int(length)
  t =
  For i = To l
   c = Ascw(Mid(vali))
   If c < Or c > Then t = t + Else t = t +
   IF t >= length Then
    CutStr = Left(vali) & endStr
    Exit For
   Else
    CutStr = val
   End If
  Next
 End Function


From:http://tw.wingwit.com/Article/program/net/201311/14458.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.