Something like charIndex, but in a variable...

Malte Brill revolution at derbrill.de
Thu Apr 30 10:02:18 EDT 2015


Hi all,

thanks for the replies so far.

The problem with both matchChunk and offset are, that they will return the first occurance of the literal. So in a text like this:


orange banana tomato
banana tomato orange
tomato banana orange

on mouseUp
   local temp,tChar
   put fld 1 into temp
   put offset(char 1 of word 2 of line 3 of temp,temp) into tChar
   set the backcolor of char tChar of fld 1 to "red"
end mouseUp

Will hilite the first b instead of the one on line 3.

@Mark: charIndex does not appear to be working on the templateField. And of course it is slower in 7… :-(

All the best,

Malte






More information about the use-livecode mailing list