快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

花花公子电子游戏网站:对一篇很长的文章做到完美的分页输出



使用统计文章字数,然后达到必然字数就截断输出,然则分页的内容就会在莫名其妙的地方截断,不是很友好。

很简单,在要截断的地方相近找下面的符号:

;’”?。!;'".!

假如后面存在

就分页。主如果要钻研文章的款式。

0 then

content = Request.Form("textarea1")

PageLength = 1000 '每页字数

CLength = Len(content)

PageCount = Int(Clength/PageLength) + 1 '谋略页数

dim PageArray

redim PageArra花花公子电子游戏网站y(PageCount)

Seperator = Array(ch花花公子电子游戏网站r(13),chr(10),"。","!","?",";",",","”","’") '分隔符

PageArray(0) = 0

Pos = 0

for j=0 to ubound(Seperator)

Pos = instr(P花花公子电子游戏网站ageArray(i)+900,cont花花公子电子游戏网站ent,Seperator(j)) 'PageArray(i)+900 相近位置是100字,1-999可调

while Pos > 0 and Posi*PageLength

PageArray(i) = Pos

Pos = instr(Pos+PageLength,content,Seperator(j))

wend

if P花花公子电子游戏网站ageArray(i) > 0 then

Response.Write "0:i¦ "&PageArray(i)&"

"&j&":j"&Seperator(j)&"

"

j = j + ubound(Seperator) + 1

end if

next

for i=1 to PageCount-1

PageArray(i) = 0

Pos = 0

for j=0 to ubound(Seperator)

Pos = instr(PageArray(i-1)+950,content,Seperator(j))

while Pos > 0 and Posi*PageLength

PageArray(i) = Pos

Pos = instr(Pos+PageLength,content,Seperator(j))

wend

if PageArray(i) > 0 then

Response.Write i&":i¦ "&PageArray(i)&"

"&j&":j"&Seperator(j)&"

"

j = j + ubound(Seperator) + 1

end if

next

next

output = mid(content,1,PageArray(0))

output = replace(output,chr(13),"

")

Response.Write "

第1段

"

Response.Write output

for i=1 to PageCount-2

output = mid(content,PageArray(i-1)+1,PageArray(i)-PageArray(i-1))

output = replace(output,chr(13),"

")

Response.Write "

第"&i+1&"段

"

Response.Write output

next

'着末一段的输出就没写了

else

%>

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: