文本格式转为数库数据 代码示例, 供参考~
程序代码:
******@***@******
******@***@******
proc 更新对阵
sele *,spac(200) ztxt,spac(30) 别名1,spac(30) 别名2 from k_based where .f. into tabl &temp\lsnew
appe fiel ztxt from &temp\ls_更新 deli
repl all ztxt with uppe(allt(ztxt))
repl ztxt with strt(ztxt,"VS"," ") for "VS"$ztxt
repl ztxt with ltrim( subs(ztxt,at(" ",ztxt)) ) for at(" ",ztxt)<4 && 序号
dele for "**源格式"$ztxt .or.( len(allt(ztxt))<10 .and..not.&z年co )
pack
repl ztxt with dtoc(date()-7) +" 11:11 " +ztxt for occu(" ",allt(ztxt))<=3 .and.val(ztxt)<2001001 && 序号 主队VS客队
repl ztxt with left(dtoc(date()),5) +ztxt for !( left(dtoc(date()),4)$ztxt .or.left(dtoc(date()-7),4)$ztxt ) && 9.26 21:30 主队 [VS] 客队
go top
brow wind winnt fiel 序号=recn():6,ztxt:120 titl " 更新对阵, 源记录总览~"
***
ls期号="???????"
ls截止=dtoc(date())
scan for !empt(ztxt)
if at(" ",ztxt)=8 .and.&z年co
ls期号 =left(ztxt,7)
ls截止 =dtoc(ctod( allt(subs(ztxt,8)) ))
ls场次 =0
loop
endif
if "???????"$ls期号
loop
endif
ls场次=ls场次+1
repl 期号 with ls期号, 截止 with ls截止, 场次 with "[" +padl(ls场次,2,"0") +"]"
nn=at(" ",ztxt)
lsdate=dtoc(ctod(left(ztxt,nn-1)))
repl ztxt with ltrim(subs(ztxt,nn))
nn=at(" ",ztxt)
lstime=lsdate +" "+left(ztxt,nn-1)
repl zdate with lsdate, ztime with righ(ttoc(ctot(lstime)),5), ztxt with ltrim(subs(ztxt,nn))
nn=at(" ",ztxt)
repl 别名1 with left(ztxt,nn), ztxt with ltrim(subs(ztxt,nn))
nn=at(" ",ztxt)
repl 别名2 with left(ztxt,nn)
endscan
...