On Jun 6, 2011, at 12:53 AM, Aparajita Fishman wrote:

>> I think there is a problem in the for each string version of for each when 
>> you modify the content of the string with [[]]
> 
> I should have made it clear in the docs that you should not modify the object 
> you are iterating within a for each loop. If you need to modify the object, 
> use a simple for loop.

Maybe you should just remove the optional index from v11+ since it serves no 
purpose and is zero based instead of 1 based. That way if there was code 
written in 4.x that did modify the string, it would blow up.

I'll point out that even using a for loop, you'd better be careful using [[]]. 
I was replacing certain characters within a quoted json string with a high 
ascii value ( replace colon with char(251). Not sure what unicode did with 
that, but I would get strange results with certain codes on my replace with the 
* operator, following a required how many - if you need the code option.  I 
tried 2 byte codes (1000) and low ascii (31) and would run into conditions that 
seemed to put the replacements at the end of the string instead of the index.

I finally just gave up and just looped through the text and created a character 
by character copy with the replacement codes when needed.

Just proves again what a crappy language and db 4D is (IMHO).  I pity those who 
have to use it. 

Steve Alex
_______________________________________________
Active4D-dev mailing list
Active4D-dev@aparajitaworld.com
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/

Reply via email to