Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Parsing Based On Capital Words. VB2005


  • Please log in to reply

#1
guardian01

guardian01

    New Member

  • Member
  • Pip
  • 1 posts
Hey Guys,

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.

Such as

"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.
example:

myreader.textfieldtype= fileio.fieldtype.delimited
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
myreader.setdelimiters(" ")

dim currentrow as string()
while not myreader.endofdata

try
current row=myreader.readfields()
dim currentfield as string

for each current field in currentrow
a=a+1
b.add(currentfield, a.tostring)
next

end try
end using

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.

  • 0

Advertisements


#2
stettybet0

stettybet0

    Trusted Tech

  • Technician
  • 2,579 posts
Hi guardian01, welcome to G2G!

Could you please try to clarify what you are trying to do... for example:

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.


"IVORY IS A PLANT" would be item 1 in collection


Based on the first sentence, wouldn't "IVORY", "IS", "A", and "PLANT" all be different items?
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP