More Practical Home page call two functions of the article

Source: Internet
Author: User
Tags chr functions html tags strlen
Comparison | function

Function cpimages (countent) ' shows the picture in the article
Beginstr=instr (countent, "src=")
Heodinstr=instr (Beginstr,countent, "")
Countent=mid (countent,beginstr+4,heodinstr-beginstr-4)
Cpimages=countent
End Function


Function Cutstr (Str,strlen)
' Remove all HTML tags
Dim RE
Set re=new REGEXP
Re. IgnoreCase =true
Re. Global=true
Re. Pattern= "< (. [ ^>]*) > "
Str=re. Replace (str, "")
Set re=nothing
Dim L,t,c,i
L=len (str)
T=0
For I=1 to L
C=abs (ASC (str,i,1))
If c>255 Then
T=t+2
Else
T=t+1
End If
If T>=strlen Then
Cutstr=left (str,i) & "..."
Exit for
Else
Cutstr=str
End If
Next
Cutstr=replace (CUTSTR,CHR (10), "")
Cutstr=replace (CUTSTR,CHR (13), "")
Cutstr=replace (CUTSTR,CHR (32), "")
End Function

The first one to extract the path to the first picture in a passage.

The second function, on the contrary, can be used to get rid of the HTML tags in the 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.