最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp 字符截取程序代码
时间:2022-07-02 23:04:54 编辑:袖梨 来源:一聚教程网
Public Function CutStr(byVal val,byVal length,byVal endStr)
Dim l,t,c,i
If val = "" Or IsNull(val) Then
CutStr = ""
Exit Function
End If
If length = "" Or Int(length) <= 0 Or IsNumeric(length) = False Then
CutStr = val
Exit Function
End If
val = LoseHTML(val)
l = Len(val)
length = Int(length)
t = 0
For i = 1 To l
c = Ascw(Mid(val,i,1))
If c < 0 Or c > 255 Then t = t + 2 Else t = t + 1
IF t >= length Then
CutStr = Left(val,i) & endStr
Exit For
Else
CutStr = val
End If
Next
End Function
Public Function LoseHtml(ContentStr)
If ContentStr = "" Or IsNull(ContentStr) Or IsEmpty(ContentStr) Then
LoseHtml = ""
Else
Dim tempLoseStr,regEx
tempLoseStr = Cstr(ContentStr)
Set regEx = New RegExp
regEx.Pattern = "*[^<>]*>"
regEx.IgnoreCase = True
regEx.Global = True
tempLoseStr = regEx.Replace(tempLoseStr,"")
LoseHtml = tempLoseStr
End if
End Function
相关文章
- 原神2025最新兑换码有哪些 限时前瞻福利领取 11-16
- 百炼英雄2025兑换码大全 最新礼包福利领取合集 11-16
- 寻道大千2025兑换码 最新可用的礼包码合集 11-16
- 蛋仔派对2025兑换码 最新礼包码合集 11-16
- 元气骑士2025兑换码大全 最新可用礼包码合集 11-16
- 明日方舟终末地测试资格查询入口 官方验证方法一览 11-16