How to avoid that « 3 » be in « 34 » ?

André.Bisseret Andre.Bisseret at inria.fr
Sun Jan 22 09:37:10 EST 2006


I wrote :
---------------
If I have “AB-b3” in myVar and “AB-b34” in a fld “myField”
when I script :
If myVar is not in fld “myField” then put cr & myVar after fld
“myField”
---------------
  First of all: A lot of thanks to Mark1, Mark2, Mark3 and Jim for their 
answers.

Ok, Mark1 and Mark3, « if myVar is not among the lines » solves my 
problem.


The solution of Mark2:
-----------------------
Also, assuming that there are no spaces in the values in the field:
if (myVar & space) is not in fld "myField" then put cr & myVar after 
fld "myField"
-----------------------
Does not do what I am trying to do. Yes, there are no space in the 
field ; so because (myVar & space) is never in the field, myVar is 
always put after myField regardless of its value (so even if its value 
is already in myField).


The solution of Jim :
--------------------------
answer wordoffset("AB-b3", fld 1)
set the wholematches to true
answer  wordoffset("AB-b3", fld 1)
---
set the wholematches to true
if wordOffset(myVar,fld 1) < 1 then --it is not found
----------------------------
it works well but in my current case, I would like the users not to 
have to click « OK » in anwer boxes. Then I tried :
-------------
set the wholematches to true
if wordOffset(myVar,myField) < 1 then put myVar & cr after myField
--------------
that works as well.

André





More information about the use-livecode mailing list