?
快捷搜索:  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

%>

免責聲明:以上內容源自網絡,版權歸原作者所有,如有侵犯您的原創版權請告知,我們將盡快刪除相關內容。

您可能還會對下面的文章感興趣:

快三平台开户