超長字元的分頁顯示

2021-04-16 21:36:29 字數 2009 閱讀 5372

<%

if request.servervariables("content_length") > 0 then

content = server.htmlencode(request.form("textarea1"))

pagelength = 1000 』每頁字數

clength = len(content)

pagecount = int(clength/pagelength) + 1 』計算頁數

dim pagearray

redim pagearray(pagecount)

seperator = array(chr(13),chr(10),"。","!","?",";",",","」","'") 』分隔符

pagearray(0) = 0

pos = 0

for 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*pagelength

pagearray(i) = pos

pos = 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 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 pos < (i+1)*pagelength and pos > i*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

output = mid(content,pagearray(ubound(pagearray)-2)+1,clength)

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

")response.write "

第"&pagecount&"段

"response.write output

else

%>

<%end if%>

實現超長文字分頁顯示

一 1 index.php 讀取超長文字中的資料,實現超長文字中資料的分頁顯示 if get page 頁次 頁 分頁 if get page 1 if get page 2 function.php 定義乙個用於擷取一段字串的函式msubstr function msubstr str,start...

字串超長

void mailsystemcell resizestring std string str,int len std string language localcontroller shared getlanguagefilename len cclabelif canbesupportedwit...

oracle的分頁顯示 字串擷取

1.oracle 分頁查詢 參考 無order by情況下 select from user where rownum 3 and rownum 4 oracle機制是第一條行號資料不符 3,去掉,原來的第 二行變為第一行,行號還是為1,一直不符合 select id,name from selec...