登陆 | 免费注册(只需一分钟) | 会员中心

聚宝网   购物专题 基金专题 性专题 饮食专题 教育专题 生活大参考 园林资讯 园艺库 健康专题
  论文专题 家庭养花 园林景观 盆景奇石 激情图库 农业资料库 园林古建 英文站 花卉栽培

聚宝网免费为您提供 最新IT资讯

 

首页 > 编程文档 > Asp
关于无组件上传程序中,自定义函数[instring()]的疑问?关键字:化境 string stream
时间:2007-06-17  www.jubao163.com  来源: 不详

Private Function inString(theStart,varStr)
    dim i,j,bt,theLen,str
    InString=0
    Str=toByte(varStr)
    theLen=LenB(Str)
    for i=theStart to upfile_5xSoft_Stream.Size-theLen
        if i>upfile_5xSoft_Stream.size then exit Function
        upfile_5xSoft_Stream.Position=i-1
        if AscB(upfile_5xSoft_Stream.Read(1))=AscB(midB(Str,1)) then
            InString=i
            for j=2 to theLen
                if upfile_5xSoft_Stream.EOS then
                    inString=0
                    Exit for
                end if
                if AscB(upfile_5xSoft_Stream.Read(1))<>AscB(MidB(Str,j,1)) then
                    InString=0
                    Exit For
                end if
            next
            if InString<>0 then Exit Function
            end if
    next
End Function

在语句的第6行:for i=theStart to upfile_5xSoft_Stream.Size-theLen
最后为什么要减 theLen 。
此函数目的是在于在整个串中查找指定的字符串,并返回所在的字节位置,难道不减这个值不行吗?我真是不明白!
---------------------------------------------------------------

你不必去求后面的东西,因为剩下的字符串(upfile_5xSoft_Stream.Size-theLen+1)已经不够输入的varStr长
---------------------------------------------------------------

他那个东西是一个字节一个字节地解析的。。好慢。。。
广告:
http://lostinet.d2g.com/Temp/Public/Lostinet_Upload_1_03.zip
---------------------------------------------------------------

是的

如果从1开始数,数完这个请求数据就可以得到upfile_5xSoft_Stream.Size
但是现在是从theStart 开始数,如果数到upfile_5xSoft_Stream.Size就超出了。所以要减一下




推荐文章
联盟网站

浙ICP备 :07003766号 Copyright © 2001-2007 JUBAO163,All rights reserved.