![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: Parsing coma delimited list Topic Summary: Created On: 8-Jul-2003 13:19 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Thank you Jonathan. Your example was great and I was able to quickly solve my problem. Thanks ![]() | |
![]() |
|
What is the best way to retieve items from a comma separated list? I have tried using Regexp of "(.*)," in a while statement but I always get the full line. Any ideas?
|
|
![]() |
|
![]() |
|
I've not done it via DXL but have in other VB/Basic script where the GetField() function makes it easy. If I had to do it via DXL I'd probably use ADO with the MS Text File Driver. I've posted a working example against MS-Access here a while ago that you should be able to find. You should be able to find ADO examples for reading the CSV online and tweak the sample code to do what you need.
Cheers, Chris |
|
![]() |
|
![]() |
|
Mike
Regular expressions always try to match the longest possible piece of string. So if your string is "abc,def,ghi," then "(.*0)," will match the whole string. What you need to do is match an length of string which doesn't have commas in it "[^,]*" As in: string test = "abc,def,ghi" Regexp reg = regexp "[^,]*" while ((reg test) && (!null test)) { print test[match 0] "\n" test = test[end 0 + 2:] } Jonathan Marshall EADS Astrium ------------------------- Jonathan Marshall EADS Astrium |
|
![]() |
|
![]() |
|
Thank you Jonathan.
Your example was great and I was able to quickly solve my problem. Thanks ![]() |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Parsing coma delimited list
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.