所属类别:Asp
文章作者:佚名
特别推荐:免费发布信息 承包关键词~~抢爆了!HOT!
利用统计文章字数,然后达到一定字数就截断输出,但是分页的内容就会在莫名其妙的地方截断,不是很友好。很简单,在要截断的地方附近找下面的符号:;’”?。!;'".!如果后面存在或就分页。主要是要研究文章的格式。<%if Request.ServerVariables("Content_Length") > 0 thencontent = Request.Form("textarea1")PageLength = 1000 '每页字数CLength = Len(content)PageCount = Int(Clength/PageLength) + 1 '计算页数dim PageArrayredim PageArray(PageCount)Seperator = Array(chr(13),chr(10),"。","!","?",";",",","”","’") '分隔符PageArray(0) = 0Pos = 0for j=0 to ubound(Seperator)Pos = instr(PageArray(i)+900,content,Seperator(j)) 'PageArray(i)+900 附近位置是100字,1-999可调while Pos > 0 and Pos < (i+1)*PageLength and Pos > i*PageLengthPageArray(i) = PosPos = instr(Pos+PageLength,content,Seperator(j))wendif PageArray(i) > 0 thenResponse.Write "0:i¦ "&PageArray(i)&""&j&":j"&Seperator(j)&""j = j + ubound(Seperator) + 1end ifnextfor i=1 to PageCount-1PageArray(i) = 0Pos = 0for j=0 to ubound(Seperator)Pos = instr(PageArray(i-1)+950,content,Seperator(j))while Pos > 0 and Pos < (i+1)*PageLength and Pos > i*PageLengthPageArray(i) = PosPos = instr(Pos+PageLength,content,Seperator(j))wendif PageArray(i) > 0 thenResponse.Write i&":i¦ "&PageArray(i)&""&j&":j"&Seperator(j)&""j = j + ubound(Seperator) + 1end ifnextnextoutput = mid(content,1,PageArray(0))output = replace(output,chr(13),"")Response.Write "第1段"Response.Write outputfor i=1 to PageCount-2output = mid(content,PageArray(i-1)+1,PageArray(i)-PageArray(i-1))output = replace(output,chr(13),"")Response.Write "第"&i+1&"段"Response.Write outputnext'最后一段的输出就没写了else%><%end if%> 关闭本页
相关信息· WAP初级教程笔记--1
· 算法讲义(2) -数论算法 I
· Ubuntu Linux系统下声卡独占的解决方法
· 让路由器摆脱安全困扰的十条策略
110833
24810
