Offset() and wordOffset() odd behavior

Robert Sneidar bobs at twft.com
Sat Mar 25 23:51:45 EST 2006


Maybe I am missing something. Observe the following code:

put ("store " & quote & "1234" & quote & " to mbob1, mbob2, mbob3")  
into fline
-- which produces a string "store "1234" to mbob1, mbob2, mbob3"
-- Notice the embedded quotes
put wordOffset("to", fline) -- returns 1, as in the first word after  
the last embedded quote

Apparently the quotes are resetting the counter for the function. My  
problem is, I am writing a script that can convert some basic Foxpro  
source code to Revolution Script. It's perfectly acceptable in Foxpro  
to say:

store "1234" to mbob1, mbob2, mbob3

and Foxpro programmers do it early and often to initialize variables.  
I am trying to end up with:

put "1234" into mbob1
put "1234" into mbob2
put "1234" into mbob3

Trouble is, I do not know what may come before the word "to". It  
could be any construct. Since Revolution does not support putting  
something into multiple variables, this becomes problematic to  
convert. I suppose I could hack a way around it. I think I will end  
up using offset() instead to avoid this. It's just a curious thing  
that Revolution will treat fline as one whole string, but the  
function seems to burp when it encounters embedded quotes.

Not complaining, just observing.

Bob Sneidar
IT Manager
Logos Management
Calvary Chapel CM

ps. Just an update. Offset() returns 2 when I use Offset("to", fline)  
BUT... here we go kiddies... Offset(" to ", fline) returns the  
correct value of 13! Hah! I guess you could say the function is  
blowing chunks! (A little [very little] programmers humor). Notice  
the spaces before and after "to". What an odd function! 


More information about the use-livecode mailing list