how to split string raed from binary file

shay Avital

Member
Joined
Oct 9, 2020
Messages
12
Programming Experience
Beginner
Hi,

i have a binary file which has only one line.
i read the values into string array but i cant find a way to split it.
the line inside the file looks like that:
COM3120281959QNG19600TrueTrueTrueTrueCOM3220004199QNG4-NV



can anyone please help with an idea?

thank you,

Shay.
 
Looks more like a text file rather than a binary file... Are you sure the file is a DOS/Windows based file which uses both the "\r\n" line delimiters? Or is it an older file that only uses "\r" or "\n" as the delimiters.

If there are no delimiters that you can identify for the file, you can't use Split(). You'll have to parse the stream of bytes figure out where the logical breaks are at.
 
Look at the byte values for example with a hex viewer, see if there is some kind of delimiter that you can't see in string.
 
You might also consider what the text actually represents. We can't tell you how to split random text. It's fairly obvious what part of it represents but some of it could mean anything. Where is it coming from exactly? If whoever wrote it didn't think about how it would be read then there may not actually be any way to reliably read it back into its original form.
 

In the string shown, there is nothing to use as a "split key"

For something like: a b d c e f g we could use " " as a split key
For something like: a,b,c,d,e,f,g we could use "," as a split key

For abcdefg there is nothing there to "key off of"

Andrew
 
Back
Top Bottom