An ASP's function to intercept n-HTML characters from a string-application tips

Source: Internet
Author: User

' function name: gethtmlcontent ' parameter:no--> the number of characters to be taken, txtcontent--> the string  
' functionality to be processed:  to intercept n-HTML characters from a string. Now the implementation is not perfect, the process is: Find the beginning of a variety of controls from the string, and then separated by some, put in the array, and then an array of added to see whether the character is greater than the given character if it is, then return the array.
' Author: Liu Yongfa
' time:2007-6-1 20:03 :)
function gethtmlcontent (no, txtcontent)
If  len (txtcontent) <= no then
gethtmlcontent = txtcontent
ExitFunction
EndIf

Set re =new regexp
Re. Ignorecase =true
Re. Global =true
patrn = "<p|<br|<li|<table"
Patrn = split (patrn, "|")

Foreach p in patrn
Re. Pattern = p
Txtcontent = re. Replace (txtcontent, "| |") & p )
Next

Txtcontent = split (txtcontent, "| |")
Foreach e in txtcontent
If len (s) >no thenexitfor
s = s +  e
Next
gethtmlcontent = s
endfunction
%> 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.