[Gambas-user] Issue 485 in gambas: 'Like' square brackets problem

Kende Krisztián nemh at ...2007...
Thu Dec 26 10:54:16 CET 2013


2013-12-26 06:23 keltezéssel, MinnesotaJon írta:
> It appears that the problem happens if the first letter of the string being
> matched appears anywhere in the "Pattern" before the actual match.  Your
> original examples were:
>
> Print "GambasIDE" Like "{alma,Gambas,szilva,GambasIDE,otto}"
> Output: False
>
> Print "GambasIDE" Like "{alma,GambasIDE,szilva,Gambas,otto}"
> Output: True
>
> *Actually, any "g" in the list, before "GambasIDE", will interfere with the
> match:*

Print "GambasIDE" Like "{alma,Gambas,szilva,GambasIDE,otto}"
Output: False

But this:

Print "GambasIDE" Like "{alma,GambasA,szilva,GambasIDE,otto}"
Output: True

So if the full-length word isn't included in the other, this problem 
doesn't occur. But the small and capital letters really don't matter.


> Print "GambasIDE" Like "{alma,g,szilva,GambasIDE,otto}"
> Output: False

Yes, "False" with the words: "g", "ga", "gam", "gamb", "gamba" and "gambas".


> but:
>
> Print "GambasIDE" Like "{alma,szilva,otto,GambasIDE,g}"
> Output: True
>
> It is only the *first letter* in the "Pattern" that is a problem -- the
> other letters do not have any bad effect.  If we delete the "g" from the
> word "Gambas", the result is correct:
>
> Print "GambasIDE" Like "{alma,ambas, ambasIDE,szilva,GambasIDE,otto}"
> Output: True

Yes, but this not good for me.

> *Note that if you use the "*" symbol, it eliminates the problem:*
>
> Print "GambasIDE" Like "*{alma,Gambas,szilva,GambasIDE,otto}*"
> Output: True
>
> *....*  eliminates the sensitivity of the patterns to their location in the
> list.

Yes, one "*" is enough to end:

Print "GambasIDE" Like "{alma,Gambas,szilva,GambasIDE,otto}*"
Output: True

But this not good for me, because GambasIDE <> GambasID

Print "GambasID" Like "{alma,Gambas,szilva,GambasIDE,otto}*"
Output: True

But of course I need equivalency.

> Regards,
> Jon
>
>
>

Kendek





More information about the User mailing list