I think there is a problem in the for each string version of for each when you
modify the content of the string with [[]]
This is code condensed from my jsonSimpleParse method. The code would replace
certain characters is the json with high-value ascii values, parse and create a
execute string, then return the replaced characters with the original value.
The following example just replaces a colon in a quoted string with another
character (#) using both the fes version and the for version.
$json := '''{"menu" : {"sharp":"flat:"}}'''
$inQuote := false
write to console('fes begin $json')
for each ($json; $char; $index)
case of
:($char = '"')
$inQuote := not($inQuote)
:(($char = ":") & $inQuote)
$json[[$index]] := "#"
end case
end for each
write to console('fes end $json')
$json := '''{"menu" : {"sharp":"flat:"}}'''
$inQuote := false
write to console('for begin $json')
for ($index; 1; length($json))
$char := $json[[$index]]
case of
:($char = '"')
$inQuote := not($inQuote)
:(($char = ":") & $inQuote)
$json[[$index]] := "#"
end case
end for
write to console('for end $json')
return
The console output produces:
fes begin {"menu" : {"sharp":"flat:"}}
fes end {"menu" : {"sharp":"fla#:"}}
NOTE: # replaced the t instead of the :
for begin {"menu" : {"sharp":"flat:"}}
for end {"menu" : {"sharp":"flat#"}}
I'd post this as a problem, but not sure if v11 has restrictions on using [[]]
to replace characters, that it's a 4D bug or Active4D bug.
Steve Alex
_______________________________________________
Active4D-dev mailing list
[email protected]
http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev
Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/