I was hoping someone could help me solve a problem I'm having using vb2005 to parse a text file. I'm trying to parse the text file by Sentences that start with Words that are all Captial. Such as, IVORY is a type of Plant.
The idea is parse a sentence at a time that starts with a Word in Full CAPs and place it in a collection.
"IVORY IS A PLANT" would be item 1 in collection
"SOMEBODY help me" would be item 2 in the collection.
the way the text file is its one solid block of sentences, with random carriage returns.
So I need the program to parse based off setences that start with word in full caps and ends before The next word with full caps. Since the document does not contain periods just commas that are using to complient the sentence not end it.
I've managed to write code that would place delimited values into collections using comma as the limiter. So that I could get the rest of the logic complete.
I've tried using the built in commands to do this, however they seemt o only take fixed characters rather then muitiple ones.
Is there a way to check each word, and they when its found place the sentence in.
myreader.setdelimiters( string like [A-Z])
Any help you guys could offer would be great. Thx
The Code I'm using is.
using myreader as new microsoft.visualbasic.fileio.textfieldparser(".\star.txt")
myreader.textfieldtype = fileio.feildtype.delimited
dim currentrow as string()
while not myreader.endofdata
dim currentfield as string
for each current field in currentrow
An example of the text file is.
DOBERMAN A BIG handsome
boy! 1 year, trained & clean, loves
kids! Reg’d, intact
ENGLISH Bulldog pups for sale
home-raised or visit:
ENGLISH Bulldog pups, vet 4,
shots, dewormed, parents on site,
ready to go $1700
Edited by guardian01, 22 May 2007 - 12:35 PM.