ASP怎样将一串字符中的相同的字符过滤掉? <% dim str str="好好学习天天向上好好学习天天向上课" function c(str) dim str1 str1=mid(str,1,1) for i=1 to len(str) t=mid(str,i,1) if check(t,str,str1) then str1=str1+t end if next c=str1 end function function check(t,str,str1) dim ii,i ii=0 for i=1 to len(str) if t=mid(str,i,1) then ii=ii+1 end if next if ii=1 then '--只出现了一次 check=true else '--出现了多次 if str1<>"" then if instr(str1,t)>0 then check=false else check=true end if end if end if end function response.write str response.write "<hr>" response.write c(str) %>
|