Import Double quotes within Double Quotes

Doug Easterbrook doug at artsman.com
Mon Dec 15 09:50:15 EST 2014


I don't know the source of the file, but kelly has an external that parses files.

we also have an external that imports XL or XLS spreadsheets ( free from us)...   and we don't worry about that parsing -- its also blazingly fast.

why write whats done.




Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 536-1205    Fax (403) 536-1210

> On Dec 15, 2014, at 3:01 AM, ADJob <mats at adjob.se> wrote:
> 
> Hi all,
> 
> The challenge:
> 
> Example string: This import "string contaning ”within quotes” etc” and so on
> 
> The spaces should be replaced with kTab (tabulator) outside the quotes and kSp (space) within the double quotes:
> 
> This(kTab)import(kTab)string(kSp)containg(kSp)text(kSp)”within(kSp)quotes”(kSp)etc(kTab)and(kTab)so(kTab)on(kCr)
> 
> So far i have managed to do this in a slow way looping character by character:
> 
> For lv_POS from 1 to len(lv_STRING) step 1
> 	If mid(lv_STRING;lv_POS;1)=kDq     ;; turn on and off the kTab - start and end of kDq
> 		Calculate lv_kDq as pick(lv_kDq;kTrue;kFalse)
> 	End If
> 	If lv_kDq=kFalse
> 		If mid(lv_STRING;lv_POS;1)=kSp
> 			Calculate lv_STRING as con(mid(lv_STRING;1;lv_POS-1);kTab;mid(lv_STRING;lv_POS+1;len(lv_STRING)))
> 		End If
> 	End If
> End For
> 
> There is two problems. This is slow and it does not work if there is quotes within quotes.
> 
> Question: Is there a way to detect the difference between this two strings?
> 
> string 1 text outside ”text inside ”and within inside” inside quotes”
> string 2 text outside ”text inside” and the second "inside quotes”
> 
> I have tried with strtok() that is faster, but the embedded double quotes is not detected in a correct way.
> 
> Thanks in advance for any clue,
> 
> Mats_____________________________________________________________
> Manage your list subscriptions at http://lists.omnis-dev.com



More information about the omnisdev-en mailing list