Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
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