Help with parsing text file

J

Joey Martin

I have been reading documentation on parsing. I need some help though.
I have the following in a text file:
$650
Number of Bedrooms 3
Air Conditioning? Yes
Original Ad SOUTH, 3BR, air, basement. $650. Call 278-4171.
First Appeared in the Newspaper
Thursday, October 30, 2003

$775
Number of Bedrooms 3
Number of Bathrooms 2
Type of Parking Garage
Street Address Cashel Ct
Original Ad . New 3BR,2BA, garage. $775. 229-6575
First Appeared in the Newspaper
Friday, October 31, 2003


I want to be able to parse each line of text into a database
(fields:bedrooms,bathrooms,etc), one field for each line.

But, After the text 2003 I need it to know that is the next record.

What would you recommend? I know this is pretty general, but any help is
appreciated!
 
W

William Morris

Looks like two carriage return - line feeds is the record delimiter. So...

Array1 = Split(sourceString, vbcrlf & vbcrlf)
For counter1 = 0 to ubound(Array1)
Array2 = Split(Array1(counter1), vbcrlf)
For counter2 = 0 to ubound(Array2)
'--- process the "record" here...
Next
Next

- Wm
 
D

dlbjr

Joey
Is there a set number of items that can be in the list?
Is there any pattern to the listings?

-dlbjr

Discerning resolutions for the alms
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top