[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: EXISTS WITHIN (Decimal-238, string "exists within" string)



Pierre d'Or jcvanhaeften@xxxxxxxx wrote:

I want to know if a certain string is occuring in an other
string, and thats what this logical operator does.
But how to use it in an IF ?
Well, it LOOKS like a logical operator, but in fact it returns, not a Y
or N, T or F condition, but a numerical value: the location of the
substring within the larger string. Here's what the XPL guide, which
Robert recently rendered into digital form (to our profound thanks) says:
For example, the following code saves the string abc to macro 01 and saves the string defgh to macro 91. The IF statement tests whether the string operator returns a value of -1, meaning that the characters in macro 01 are not present anywhere in macro 91.

 ≪SV01,abc≫≪SV91,defgh≫≪IF≪IS01≫e≪IS91≫==-1≫≪GLNO≫≪EI≫
Since the comparison of macros 01 and 91 returns a value of -1, the IF statement is true; and the program goes to the label NO.
As another example, the following code saves the string abc to macro 01
and saves the string xyzabcd to macro 92. The IF statement tests whether
the string operator returns a value greater than or equal to 0, meaning
that the characters in macro 01 are present somewhere in the string
saved in macro 92.

 ≪SV01,abc≫≪SV92,xyzabcd≫≪IF≪IS01≫e≪IS92≫>=0≫≪GLYES≫≪EI≫
The comparison of macros 01 and 92 returns a value of 3, because three characters precede abc in the string xyzabcd. Therefore, the IF statement is true; and the program goes to the label YES.
Watch out in that last bit of pseudocode: what appears to be a third single > before the equal sign is a greater-than symbol, whereas the two before it are pseudocode for the closing guillement.
But how on earth are you getting Wildcards in Xy III? Was this an
enhancement the European versions had? What's the date of your editor.exe?

Patricia M. Godfrey
psicamg@xxxxxxxx