- '**************************************************
- ' Function name: gottopic
- ' function: truncated string, Chinese characters one count two characters, English count a character
- ' parameter: str----the original string
- ' strlen----intercept length
- ' Return value: The truncated string
- '**************************************************
- Function gottopic (ByVal str, ByVal strlen)
- If str = "Then"
- Gottopic = ""
- Exit Function
- End If
- Dim L, T, C, I, strtemp
- str = replace (replace (replace (str, "," ")," "", Chr), ">", ">"), "<", "<")
- L = Len (str)
- t = 0
- strtemp = str
- strlen = CLng (strlen)
- For i = 1 to L
- c = Abs (ASC (in Mid (str, I, 1))
- If C > 255 Then
- t = t + 2
- Else
- t = t + 1
- End If
- If T >= strlen Then
- strtemp = left (str, i)
- Exit for
- End If
- Next
- If strtemp <> Str Then
- strtemp = strtemp & "..."
- End If
- Gottopic = replace (replace (replace (strtemp, "", ""), Chr, "" ")," > "," > ")," < "," < ")
- End Function
- ?>
Copy Code |