Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string manipulation tutorial

Status
Not open for further replies.

doyle9732

Programmer
Apr 12, 2002
185
0
0
CA
I have searched the web, and this site but have had no luck in finding a tutorial or set of examples for what I'm needing to do.

I have input that comes in as just a stream of data and it has numerous snippets of information I need to capture.

I need to go through the text and find key words and capture them.....Once the key word is found I have to capture data preceeding and following the key word.

i.e. the incoming stream of data is:

boxer fawn dog 12 34 lab black dog 3 50 yorkshire tan dog 7 35

Dog is the key word, the two words preceeding dog are the breed and colour, and the two numbers following dog are the age of the dog and the age of the owner. Dog is the only consistent word I can try to capture. The actual stream is quite large as well.

I want to put them is a list: boxer brown dog 12 34, lab black dog 3 50, yorkshire tan dog 7 35

and then I can (hopefully) manipulate the data, but so far, I haven't even figured out how to capture the individual snippets of information.

Thanks!
Stephanie
 
You can try a two-step process: Find the third space after "dog" and replace it with a comma. Use the result as a space-delimited list to process the individual elements.
Of course this would fall over if the stream also has cats or alligators. Then you'd need to weed those out.

Read up on the various list functions to get an idea of how to do this. Especially think about using the space character as a delimiter in your initial pass at the data.

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.
 
You are going to need to use REFind and someone besides me is ging to need to help write a regular expression to find the pattern of words/space/number/space/number

then I would plug it into an array of structures a queryobject, etc...your choice.

Kevin

Phase 1: Read the CFML Reference
Phase 2: ???
Phase 3: Profit!
 
arrays of structures? [shudder]

Stephanie, what do you mean by "stream" of data?

are there records? in a file?

are you always looking for a dog? i.e. the same keyword?

then simple string functions should do it

(i avoid arrays and structs if i can ;-))

r937.com | rudy.ca
 
by 'stream' I mean an xml feed from an external website. Comes in as just a clump of text. The key word is consistent, so I can capture that, but having the unique information before AND after the key word throws me. Regular expressions just confuse me and taunt me with their various characters :-s

If anyone knows a good tutorial on string manipulations (with examples), I'd love to visit it. I don't find my Que book overly helpful, nor the Macromedia pages.

Once I have a list or array, I then need to compare some of the data. Give me good ole if statements over string manipulations anyday!

Thanks!
Stephanie
 
waitwaitwaitholdon....

someone is bothering to produce 'xml' but can't take the time to define these three elements? ? ?

Do you have ANY control over this, a strong suggestion to them, or anything? can I see the url of the xml?






Kevin

Phase 1: Read the CFML Reference
Phase 2: ???
Phase 3: Profit!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top