realbasic-nug
[Top] [All Lists]

Re: Reading comma delimited data

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Reading comma delimited data
From: Didier Barbas <lists at sungnyemun dot org>
Date: Sat, 31 Aug 2002 22:46:22 +0900
A first comment: it is NOT reasonable to have commas lying around your
fields in a CVS-like file. Escaping them would save you a lot of grief and
would make your work easier...

When you store your fields, be sure to escape the commas to \, Then, when
you read your lines of data, a simple regex will help you separating the
fields: (.*?[^\\])(,|$) This will help you sift through the fields.

Contact me off-list if you want an sample programme (I made one to test the
regex).


-- 
Didier Barbas
Dilettante programmer and linguist
http://ww.sungnyemun.org



Why can't hearing aids be configured with regExes?
preg_replace (/(([bullshit])([good stuff]))*/, / \\3/);
Huh?



On 8/31/02 2:08 AM, "chris" <cb at mythtech dot net> wrote:

>> So I didn't see any mention of use of regEx to solve this problem.
>> 
>> if you use a regEx, then you can keep your same code structure. "? will
>> find 0 or one ". If you need a clearer example let me know.
> 
> Sheesh... now I have to learn RegEx too?!?
> 
> Actually, I made the changes last night to use the OpenCSVCursor. It
> worked REALLY well, and made my code a bit more manageable and readable
> in the process.
> 
> 
> But it looks like I really should learn about RegEx soon... I think it
> will help me in the future (much of what I do is assorted text processing
> of records, turning data from one system into a match for another
> system). Time to reread my copy of the first issue of REALbasic
> Developer... it has a couple of nice RegEx articles.
> 
> -chris
> <http://www.mythtech.net>


---
A searchable archive of this list is available at:
<http://dbserver.realsoftware.com/KBDB/search.php>

Unsubscribe:
<mailto:realbasic-nug-off at lists dot realsoftware dot com>

Subscribe to the digest: 
<mailto:realbasic-nug-digest at lists dot realsoftware dot com>
.


<Prev in Thread] Current Thread [Next in Thread>