ASP 英文单词 空格 问题

来源:百度知道 编辑:UC知道 时间:2024/04/28 15:51:00
Function CutStr(str,strlen) '取指定字符串的指定长度
Dim l,t,c,i
str=ShowText(str)
l=len(str)
t=0
For i=1 To l
c=Abs(Asc(Mid(str,i,1)))
If c>255 Then
t=t+2
Else
t=t+1
End If
If t>=strlen Then
cutStr=left(str,i)&"..."
Exit for
Else
cutStr=str
End If
Next
End Function
帮我分析下 这个问题..
比如 love you 会显示成loveyou
Function ShowText(Text)
Text=replace(Text,"<br>","")
Text=replace(Text,chr(32),"")
Text=replace(Text,chr(13),"")
Text=replace(Text,chr(10),"")
Text=replace(Text,chr(9),"")
ShowText=replace(Text," ","")

==============================
这个ASP字串空格问题非常容易解决
==============================
首先用ASP的TRIM Function将字串的前后空格去掉,之后便不必利用REPLACE Function将字串空格换成"",如此便不会影响字串里的空格,例如LOVE YOU便不会成为LOVEYOU。
 

你还有一个 ShowText 封装函数没有贴上来吧。