New topic: Parsing Text with no delimiter
<http://forums.realsoftware.com/viewtopic.php?t=26178> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message paulg Post subject: Parsing Text with no delimiterPosted: Fri Jan 23, 2009 11:53 pm Joined: Thu Oct 05, 2006 11:45 pm Posts: 143 Hi I have a text file of names and addresses that I want to try to figure out how to parse in RB. Parsing text in RB is not something I have a lot of experience with and I am hoping to learn how to do this for future projects and I need some help to get it. The Background: I have a text file at work that I captured from a web page that has names and addresses on it for sending out a mailing. I manipulated it with Excel, Word and finally Access to get it into a 3 field database, with Name, Address, and City/State/Zip. So that is done. But I am likely going to be repeating this again and thought it would be cool to see what I could do with it in RB. I have a test app that contains a ListBox, EditField and two pushbuttons. The first pushbutton loads the text file and puts it into the EditField. The second button does nothing yet but will parse the editfield text and separate it into 3 columns. This is the part that I don't quite understand how to do. Here is how the data is structured: Name Address City state zip So as an example: Jeff Jones 1234 Main St. AnyTown CA 95444 The names and addresses repeat without a gap on and on. There are no delimiters and there are no separators from address to address. However there is a pattern and that is each group is exactly 3 lines. So my thought was to loop through the text and the first line goes in column 0, second column 1, third line goes in column 2. Then the next line goes in column 0, row1, etc. Basically the only thing I have to parse with is the pattern I mentioned and the line endings as they are all on a new line. So how do I do this? I appreciate any help or comments as I really want to get the parsing down. Thanks! _________________ This message made with 100% recycled pixels. -- REALbasic 2008r5.1 MacBook CD 2.0, 2GB RAM, 160GB HD OS X 10.5.5 Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 900 classes with 18000 functions in one REALbasic plug-in. The Monkeybread Software Realbasic Plugin v8.1. <http://www.monkeybreadsoftware.de/realbasic/plugins.shtml> [email protected]
