Now, i'm still on a lot of percoset, so i could be wrong, but here's what i've got:
version 251 and 254 return different results for:
cText:="Bob,Baune,141 South 5th Street,Bird Island,MN,55310,USA,Bob's Auto,bbaune@q.com,Ba406770,320-212-1991,,,1131"
myarray:=dc_tokenarray(cText,",",.t.)
the apostrophe on bob's auto creates improper results for version 254. 251, it's correct..
			
			
									
									dc_tokenarray() regression
dc_tokenarray() regression
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
breadmanbrian@bsky.social
http://www.breadmanrises.com
FB travel group: The Breadman Rises
						Retired and traveling around the country to music festivals in my RV.
breadmanbrian@bsky.social
http://www.breadmanrises.com
FB travel group: The Breadman Rises
Re: dc_tokenarray() regression
Try this for now until I get dig into this deeper.
cText:="Bob,Baune,141 South 5th Street,Bird Island,MN,55310,USA,Bob's Auto,bbaune@q.com,Ba406770,320-212-1991,,,1131"
myarray:=dc_tokenarray(cText,",",.FALSE.)
			
			
									
									cText:="Bob,Baune,141 South 5th Street,Bird Island,MN,55310,USA,Bob's Auto,bbaune@q.com,Ba406770,320-212-1991,,,1131"
myarray:=dc_tokenarray(cText,",",.FALSE.)
 The eXpress train is coming - and it has more cars.
						Re: dc_tokenarray() regression
The problem with this approach is i don't know what else it might break elsewhere in the software..rdonnay wrote:Try this for now until I get dig into this deeper.
cText:="Bob,Baune,141 South 5th Street,Bird Island,MN,55310,USA,Bob's Auto,bbaune@q.com,Ba406770,320-212-1991,,,1131"
myarray:=dc_tokenarray(cText,",",.FALSE.)
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
breadmanbrian@bsky.social
http://www.breadmanrises.com
FB travel group: The Breadman Rises
						Retired and traveling around the country to music festivals in my RV.
breadmanbrian@bsky.social
http://www.breadmanrises.com
FB travel group: The Breadman Rises
Re: dc_tokenarray() regression
Then my next suggestion is to copy DC_TokenArray() from _DCTOKEN.PRG of build 251 and put it in your own library for now.  When I get home I will work on a permanent fix for you.  I don't have a quick solution.
			
			
									
									 The eXpress train is coming - and it has more cars.
						Re: dc_tokenarray() regression
That was what i was planning on doing..
great minds think alike... (are you on percoset also ?? )
			
			
									
									great minds think alike... (are you on percoset also ?? )
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
breadmanbrian@bsky.social
http://www.breadmanrises.com
FB travel group: The Breadman Rises
						Retired and traveling around the country to music festivals in my RV.
breadmanbrian@bsky.social
http://www.breadmanrises.com
FB travel group: The Breadman Rises
Re: dc_tokenarray() regression
I wish I had percoset.  That was the best drug ever.  I used it after an operation.
			
			
									
									 The eXpress train is coming - and it has more cars.
						Re: dc_tokenarray() regression
Brian -
I ran the below code and it gives the proper output.
What is it that you are expecting?
Roger
			
			
									
									I ran the below code and it gives the proper output.
What is it that you are expecting?
Roger
Code: Select all
#INCLUDE "dcdialog.CH"
FUNCTION Main()
LOCAL cText, aTokens
cText:="Bob,Baune,141 South 5th Street,Bird Island,MN,55310,USA,Bob's Auto,bbaune@q.com,Ba406770,320-212-1991,,,1131"
aTokens := DC_TokenArray(cText,',')
WTF aTokens pause
RETURN nil
PROC appsys ; return The eXpress train is coming - and it has more cars.
						Re: dc_tokenarray() regression
Ok, I fixed the problem.  It was caused by using the 3rd (lQuote) parameter and having a single quote in the text.
I changed DC_TokenArray() to ignore single-quotes when using the lQuote parameter and only strip double-quotes.
This will be in build 255 to be released later today.
			
			
									
									I changed DC_TokenArray() to ignore single-quotes when using the lQuote parameter and only strip double-quotes.
This will be in build 255 to be released later today.
Code: Select all
FUNCTION dc_tokenarray( cString, cDelims, lQuote )
LOCAL nFound, i, lStart, lDoubleQuoteOn, cInString, cChar, nCount := 0, ;
      aTokens[0], lSingleQuoteOn
DEFAULT lQuote := .f.
cDelims := IIF(Valtype(cDelims)='C',cDelims,_DCTokenDelims() )
IF EMPTY(cString)
  RETURN aTokens
ENDIF
IF lQuote
  lDoubleQuoteOn := .F.
//  lSingleQuoteOn := .F.
  cInString := cString
  cString := ''
  FOR i := 1 TO Len(cInString)
    cChar := cInString[i]
    IF cChar == '"'
      lDoubleQuoteOn := !lDoubleQuoteOn
//    ELSEIF cChar == "'"
//      lSingleQuoteOn := !lSingleQuoteOn
    ELSEIF !lDoubleQuoteOn .AND. cChar $ cDelims // .AND. !lSingleQuoteOn
      cChar := Chr(0)
    ENDIF
    cString += cChar
  NEXT
  cString := StrTran(cString,'"','')
ELSE
  FOR i := 1 TO LEN(cDelims)
    cString := Strtran(cString,SubStr(cDelims,i,1),CHR(0))
  NEXT
ENDIF
IF Len(cDelims) > 1
  IF CHR(0)+CHR(0) $ cString
    cString := StrTran(cString,CHR(0)+CHR(0),CHR(0))
  ENDIF
ENDIF
DO WHILE .t.
  nFound := AT(CHR(0),cString)
  IF nFound = 1 //.AND. Len(aTokens)=0
    AADD( aTokens,'' )
    cString := Substr(cString,2)
  ELSEIF nFound > 0
    AADD( aTokens, SubStr(cString,1,nFound-1) )
    cString := SubStr(cString,nFound+1)
  ELSE
    AADD( aTokens, cString )
    EXIT
  ENDIF
ENDDO
RETURN aTokens The eXpress train is coming - and it has more cars.
						Re: dc_tokenarray() regression
thanks...
How's your recovery coming ??
Mine's coming along "normally"
I'm doing kissimmee remotely this year.. running two machines via pcanywhere and using a remote ip phone....
			
			
									
									How's your recovery coming ??
Mine's coming along "normally"
I'm doing kissimmee remotely this year.. running two machines via pcanywhere and using a remote ip phone....
Brian Wolfsohn
Retired and traveling around the country to music festivals in my RV.
breadmanbrian@bsky.social
http://www.breadmanrises.com
FB travel group: The Breadman Rises
						Retired and traveling around the country to music festivals in my RV.
breadmanbrian@bsky.social
http://www.breadmanrises.com
FB travel group: The Breadman Rises
