|
-
Dec 21st, 2006, 08:59 AM
#1
Thread Starter
Member
Help with Split function
Hi all,
I have got a comma delimited file which uses quotes as text qualifiers. for example "Mr XXXXX","XX Street","" ....
I am using the split function to store values in a string array but my problem is when i have a field that contains a comma within the quotes eg. "XX, Street". It splits these in to different array positions.
Is there any way of avoiding this?
Thanks for your help.
Cheers
-
Dec 21st, 2006, 09:06 AM
#2
Addicted Member
Re: Help with Split function
Hi Gogi,
Im not all to familiar with that Split function, are there parameters you can add?
If not i suggest making your own functions that would save everything within the "quotes".
GL, Figa
This wont work?
Split(""a,d","b","c"" , """")
Last edited by figa; Dec 21st, 2006 at 09:13 AM.
-
Dec 21st, 2006, 09:45 AM
#3
Thread Starter
Member
Re: Help with Split function
Hi Figa
I am kind of working on my own function, but was wondering whether there is an easy way already out there. No point in reinventing the wheel :-))
thanks
-
Dec 21st, 2006, 10:05 AM
#4
Re: Help with Split function
The proper way would be to use regex but I can't provide you with a suggestion as it's beyond me. In the spilt function you can use whole strings as a delimiter, not just single characters. So, use ","(in code """,""") as a delimiter instead of just the comma.
You will still have to take care of the quotations marks (remove them from the first and last splitted strings or add them to all the strings in between respectively). Or wait for a regex suggestion.
-
Dec 21st, 2006, 10:19 AM
#5
Thread Starter
Member
Re: Help with Split function
Hi Half
thanks for the reply. I have been experimenting along those lines.
cheers
tolga
-
Dec 21st, 2006, 12:46 PM
#6
Re: Help with Split function
Check out one of my codebank submissions in my sig, there is a CSV and TAB file parser that utilizes Regex. Feel free to use the code or just use it as a reference...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|