This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Parsing Headache - Please Help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Parsing Headache - Please Help" Watch "Parsing Headache - Please Help" New topic
Author

Parsing Headache - Please Help

Chris Cairns
Ranch Hand

Joined: Jan 31, 2003
Posts: 48
Here's the problem. I need to cutoff any text to the right of and including the following words: "1CFP", "CFP", "1TNK", "TNK", "1AL1", "Al1", "1ATC", "ATC", "1WBL", "WBL", "1SHP", "SHP". (See full text below.) The constraint is that I cannot use methods or packages from Java 1.4, just 1.3. This means no regex and no strObj.split(param). (I used the latter successfully to cutoff the text, but then found out that it had to be compatible with version 1.3). I've tried a few approaches with no success. I must admit, my problem is with the logic. So I'm hoping that someone could give me some pointers. I'd really appreciate it.

[ April 08, 2003: Message edited by: Chris Cairns ]
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Maybe something like this:

Here's the output:


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Chris Cairns
Ranch Hand

Joined: Jan 31, 2003
Posts: 48
I think what I can do is grab the character length of each row. If it's greater than 69, then I'll grab a substring from 0 to 69. If not, then don't grab a substring.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parsing Headache - Please Help
 
Similar Threads
Parsing and Reformatting
Mars Spirit rover (2004)
Parsing
WA #2 ..... word association
well done india - Vs England