'函数名:getHTMLContent'参数:NO-->要取得的字符数, txtContent-->要处理的字符串 '功能: 从字符串里截取N个带HTML的字符,现在的实现方法还不完善,过程是:从字符串里找各种控件的开始,然后依些分开,放到数组里,然后一个一个数组的加上来看看字符是否大于给定的字符如果是,那么,返回这个数组. '作者:柳永法 '时间: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 %> |
请发表评论