Perfect pagination output for a long article

xiaoxiao2021-03-06  67

Use the statistics writing number, and then truncate the output, but the content of the paging will be truncated in the inexplicable place, not very friendly.

Very simple, find the following symbols near the place to be truncated:

; '""?!;' ".!

If there is

or
on the back. Mainly to study the format of the article.

<%

IF Request.ServerVariables ("Content_length"> 0 THEN

Content = Request.form ("Textarea1")

PageLength = 1000 'Each page number cLength = len (content) PageCount = int (clength / pageLength) 1' calculation page

Dim PageArrayredim PageArray (PageCount)

SEPERATOR = Array (CHR (13), Chr (10), ".", "!", "?", ";", "," "" ") 'Separator

PageArray (0) = 0POS = 0for J = 0 to Ubound (seperator) POS = INSTR (PageArray (i) 900, Content, SEPERATOR (J)) 'PageArray (i) 900 location is 100 words, 1-999 Adjustable While POS> 0 and POS <(i 1) * PageLength and Pos> i * PageLengthPageArray (i) = pospos = INSTR (POS PageLength, Content, SEPERATOR (j)) Wend

IF PageArray (I)> 0 Then Response.write "0: I |" & PageArray (i) & "
" & J & ": J" & seperator (j) & "
" J = J Ubound (seperator) 1 end ifnext

For 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)) Wend

IF PageArray (i)> 0 Then Response.write I & ": I | & PageArray (i) &"
"& J &": J "& seperator (j) &"
"J = J Ubound (seperator) 1 end ifnextNext

output = mid (content, 1, PageArray (0)) output = replace (output, chr (13), "
") Response.Write "

paragraph 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 "

of" & i 1 & "segment
" Response.Write outputnext

'The output of the last paragraph didn't write

ELSE%>