特殊文本文件的提取方法

作者在 2015-04-01 00:24:34 发布以下内容



说明:&T为一间店铺的开始,&P为一间店铺的结束,&L为一条记录的结束

Create Cursor TEST (Shopno C(10),Shopname C(30),Pos C(10),Card C(20),Amt N(10,2),Hkfee N(10,2),seq C(10),Date1 C(8) ,Time C(6))
nRow=ALines(AcStr,FileToStr("Wt.Txt"),1,Chr(13)+Chr(10))
For lnI=1 To nRow
    cStr=AcStr[lnI]
    Do Case
        Case cStr="&T"
            Scatter Memvar Blank
        Case cStr="&L"
            Insert Into Test From Memvar
        Case cStr="&P"
        Otherwise 
            lcStr=Left(cStr,At("=",cStr)-1)
            If Type(lcStr)="U"
               lcStr=""
            Else
                If Type(lcStr)=="C"
                    cStr="m."+Strtran(cStr,"=","='")+"'"
                Else 
                    cStr="m."+cStr
                EndIf 
                &cStr
            EndIf 
    EndCase
EndFor 
Browse 
Return
将下列内容放入WT.TXT中

&T DC0G
year=2010
month=01
day=01
shopno=01165
shopname=上海市XXXX用品中心
pos=PKIC
card=7856305600138091   
amt=             738.00
hkfee=      7.38
seq=322098150
date1=20100101
time=115106
&L
pos=PKIC
card=6447554451013452   
amt=              50.00
hkfee=      0.50
seq=327642032
date1=20100101
time=131913
&L
pos=PKIC
card=4518107576233370   
amt=             230.00
hkfee=      2.30
seq=345120626
date1=20100101
time=180037
&L
pos=PKIC
card=6227003144440030372
amt=             125.00
hkfee=      1.25
seq=349424489
date1=20100101
time=210216
&L
pos=PKIC
card=622165670309295   
amt=              38.00
hkfee=      0.38
seq=354447637
date1=20100101
time=214328
&L
pos=合计
card=                   
amt=            1181.00
hkfee=     11.81
seq=5
date1=        
time=      
&L
&P
&T DC0G
year=2010
month=01
day=01
shopno=01504
shopname=上海市XXXX发展有限公司
pos=PKOc
card=6345481450739058218
amt=           20000.00
hkfee=      0.00
seq=321800925
date1=20100101
time=114641
&L
pos=PKOc
card=6234581450739010011
amt=           10000.00
hkfee=      0.00
seq=321847501
date1=20100101
time=114723
&L
pos=PKOc
card=6234581451299321913
amt=           30000.00
hkfee=      0.00
seq=339969527
date1=20100101
time=161536
&L
pos=PKOc
card=6228451450004549814
amt=           10000.00
hkfee=      0.00
seq=342418206
date1=20100101
time=165637
&L
pos=PKOc
card=5334591450555209   
amt=           20000.00
hkfee=      0.00
seq=342445863
date1=20100101
time=165709
&L
pos=PKOc
card=6224441450004549814
amt=            6000.00
hkfee=      0.00
seq=342733641
date1=20100101
time=170220
&L
pos=PKOc
card=4044470016769600   
amt=           30000.00
hkfee=      0.00
seq=344821757
date1=20100101
time=175124
&L
pos=合计
card=                   
amt=          126000.00
hkfee=      0.00
seq=7
date1=        
time=      
&L
&P
&T DC0G
year=2010
month=01
day=01
shopno=02017
shopname=XX市XXXX天然美食城
pos=PKYJ
card=6225444321000315584
amt=             559.00
hkfee=     11.18
seq=326499215
date1=20100101
time=130115
&L
pos=PKYJ
card=622744451037792   
amt=             628.00
hkfee=     12.56
seq=328177081
date1=20100101
time=132729
&L
pos=PKYJ
card=406364437405491   
amt=             670.00
hkfee=     13.40
seq=328679516
date1=20100101
time=133455
&L
pos=PKYJ
card=4044470000902720   
amt=            1563.00
hkfee=     31.26
seq=331340114
date1=20100101
time=141344
&L
pos=PKYJ
card=6256734451026555   
amt=             895.00
hkfee=     17.90
seq=332217825
date1=20100101
time=142615
&L
pos=PKYJ
card=95545612106158879
amt=             238.00
hkfee=      4.76
seq=332865842
date1=20100101
time=143453
&L
pos=PKYJ
card=6224567576509580   
amt=             132.00
hkfee=      2.64
seq=333332766
date1=20100101
time=144122
&L
pos=合计
card=                   
amt=            7696.00
hkfee=     76.96
seq=24
date1=        
time=      
&L
&P

文章评论,共0条
游客请输入验证码
浏览402018次