Find string "xxx" in field yyy OF THIS CARD
Francis Nugent Dixon
effendi at wanadoo.fr
Thu Feb 2 15:39:23 EST 2012
Hi from beautiful Brittany,
Thanks to all for suggestions. I finished up by trying my own
workaround.
BUT, I don't know why the syntax "of this card" and
"of card xx" is accepted in the find command, but doesn't work.
Would that be a real bug ?
Secondly, the string I am looking for is in practically
every record of my stack, and I treat the cards one at
a time. I'm doing some complex (painful) syntax analysis
on tons of data in text files, to create a stack of cards.
So I look for various character strings with a value after them.
Thirdly, when I have "found" the strings, I use the "foundChunk"
command to set the strings to "empty" (i.e. remove them completely).
This aids the continuation of my data analysis. I need this command.
So I have solved the problem by using the "offset" command, and
using the result + the length of the offset string to build a
"findChunk" string "char xx to yy of field zzz" and then I have
the ammunition to zap the field.
I had many of these "find string" commands for many different
values, and wanted the minimum of change to my scripts
(written over many days) so that my scripts would work.
Yes ! (Sigh) - I tried solving this with a function, but it had
so many facets, that I finally resolved the problems inline.
So I replaced the following multiple instances of commands:
find string "xxx" in field yyy of this card
if the result = "not found" then exit mouseUp
put the foundchunk into SaveChunk
-- Do stuff with the data
do "put empty into " & SaveChunk
with four other commands :
put offSet("xxx",field yyy) into HoldStart
if HoldStart = 0 then exit mouseUp
put the length of "xxx" into HoldStop
put "char " & HoldStart & " to " & HoldStop & " of field zzz"
into SaveChunk
do "put empty into " & SaveChunk
Minimum Modification - maximum satisfaction !
But I'm sure lots of you guys can better my ineficient code !
-Francis
More information about the use-livecode
mailing list