Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sub wordWalk(text as string=EMPTY, wordSep as string = SP, lineSep as string = CRLF, ledger(any) as string,ww as longint)
- dim as longint scrw=0, scrh=0, scrdepth=0, scrbpp=0, scrpitch=0, scrrate=0
- dim as string scrdriver=EMPTY
- Screeninfo ( scrw, scrh, scrdepth, scrbpp, scrpitch, scrrate, scrdriver )
- dim as longint owordSep=0, olineSep=0
- if ww=0 then
- ww=scrw/8
- end if
- dim as string buffer=EMPTY,reserve=EMPTY
- dim as longint index=0,offset=0
- erase ledger
- reserve=text
- do while len(reserve) GTR 0
- owordSep=instr(reserve,wordSep)
- olineSep=instr(reserve,lineSep)
- if (owordSep GTR 0) or (olineSep GTR 0) then
- if (owordSep LSS olineSep) and (owordSep GTR 0) then
- if len(ledger(ubound(ledger,1)) & mid(reserve,1,owordSep-1)) GTR ww then
- redim preserve ledger(lbound(ledger,1) to ubound(ledger,1)+1)
- end if
- ledger(ubound(ledger,1)) &= mid(reserve,1,owordSep-1)
- reserve = mid(reserve,owordSep+len(wordSep))
- elseif (olineSep LSS owordSep) and (olineSep GTR 0) then
- ledger(ubound(ledger,1)) &= mid(reserve,1,olineSep-1)
- reserve = mid(reserve,olineSep+len(lineSep))
- redim preserve ledger(lbound(ledger,1) to ubound(ledger,1)+1)
- end if
- end if
- loop
- dim as longint fm=0
- fm=freefile
- if open("ledger.txt" for output as #fm) NEQ 0 then
- close #fm
- return
- end if
- print #fm,lbound(ledger,1),ubound(ledger,1)
- for index=lbound(ledger,1) to ubound(ledger,1) step 1
- print #fm,index,ledger(index)
- next index
- close #fm
- return
- end sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement