Text file Content to byte[]

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

BOF
BD|0001|20060403001|1
BO|1|BSE|0001|B|06/B-04130973|77160200000000001|200604031145|2005061|20060403|30/04/2006-03/04/2006|500085|EQT|AR|27.55|3
BT|1|1001|115031|100|29.05
BT|2|1009|115040|100|29.20
BT|3|1011|115044|50|29.25
EOF

This is a prototype that can be in my text file.My web service will have to
read the content of the file and will have to store it in a string[] as given
below
BOF
BD
0001
20060403001
1
BO
Please help me how to do it?
if possible a sample code snippet would help me
Thanks in advance
 
This is a prototype that can be in my text file.My web service will have to
read the content of the file and will have to store it in a string[] as given below

It sounds to me like you want to split the data into substrings that are
separated by either | or a line break. A line break is most likely vbNewLine
or vbLf. So, load the text file into string s and do operations as follows:

Dim s as string
' load the file into string s
s = Replace(s, vbLf, "|") ' possibly, vbLf should be vbNewLine
Dim a() as string
a = Split(s, "|")

At this point, a() will contain your substrings. It sounds also like you
are using C#, but my code fragment is in basic. Sorry about that. But the
idea is still fairly simple. You want to use Split() to break the text into
tokens based on a separator, and it appears that you have two separators.
 
Back
Top