Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: parsing
My problem is trying to work with the string, and parse it using the binary functions. I'd like to be able to get 011, and Jones and Sam out when I need to, for moving elsewhere.
Could anyone nudge me in the right direction as to how to isolate the individual elements in such a string using the Binary function?
If not, it might be easier to use the FileOpen/FileRead functions.
It not clear why BinaryBuffers are involved. However here are a few eamples
;#1 ;Strings ;Test Case Setup string="|011|Jones|Sam|" ;Real code a2=ItemExtract(2,string,"|") a3=ItemExtract(3,string,"|") a4=ItemExtract(4,string,"|") Message("Try 1",strcat(a2,@crlf,a3,@crlf,a4)) ;#2 ;Combo BinaryBuffer/string mode ;Test Case Setup bb=BinaryAlloc(1000) BinaryPokeStr(bb,0,"|011|Jones|Sam|") ;Real code string=BinaryPeekStr(bb,0,1000) a2=ItemExtract(2,string,"|") a3=ItemExtract(3,string,"|") a4=ItemExtract(4,string,"|") Message("Try 2",strcat(a2,@crlf,a3,@crlf,a4)) BinaryFree(bb) ;#3 ;Pure BinaryBuffers ;Test Case Setup bb=BinaryAlloc(1000) BinaryPokeStr(bb,0,"sadasdasdasd|011|Jones|Sam|asdasdasdsad") ;Real code ptr=0 ptr=BinaryIndexEx(bb,ptr,"|",@fwdscan,@false) while ptr < BinaryEODGet(bb) ptr=ptr+1 ptr2=BinaryIndexEx(bb,ptr,"|",@fwdscan,@false) if ptr2 == -1 then break substring=BinaryPeekStr(bb,ptr,ptr2-ptr) Message("Try 3 next substring",substring) ptr=ptr2 endwhile
Article ID: W14214
Filename: Parsing Dilemma.txt
File Created: 1999:10:26:11:24:08
Last Updated: 1999:10:26:11:24:08