Problem with INSTR()

Brian K. White brian at aljex.com
Wed Feb 15 13:14:52 PST 2006


----- Original Message ----- 
From: "Kenneth Brody" <kenbrody at bestweb.net>
To: <john at valar.com>
Cc: "Fplist (E-mail)" <filepro-list at seaslug.org>
Sent: Wednesday, February 15, 2006 3:27 PM
Subject: RE: Problem with INSTR()


> Quoting John Esak (Wed, 15 Feb 2006 13:50:01 -0500):
> [...]
>> >     If:  "l" eq "L"
>> >   Then:  mesgbox "'l' and 'L' are the same!"
>> >
>> > :-)
>>
>> No, no, no,.... (at the risk of sounding like the bit in Tron... :-))
>> Sorry, but that is a completely irrational analogy. What I am saying
>> (very clearly) is that the following would not get the desired results
>> from your point of view...
>>
>>     if:  l eq chr("76")
>>   then: show "Ken is right, John is wrong! :-)";  end
>>     if:
>>    then: show "John is right! :-)  -- doesn't happen often, but even a
>> blind squirrel gets the nut sometimes."
>
> Well, assuming that you meant to put quotes around the lowercase "l"
> on the first line, you will see that the first "if" is true, and the
> "Ken is right..." message will be displayed.
>
> I guess it depends on your definition of "the desired results".  :-)
>
>> Truly, I believe if someone specifies a *particular* character with the
>> use of chr(), filePro should respect that.
>
> There is no difference between "L" and CHR("76").
>
>> It does *everywhere* else I have tried, and I just tried about 10
>> different things. Why should this INSTR() function be any different?
>
> Can you give me a specific example in filePro where lowercase "l" and
> capital "L" are not the same?  (Excluding filenames on a system which
> is case-significant, of course.)


Regardless that normally filepro considers l and L to be the same, it is 
arguable that it should not consider chr("76") and chr("108") to be the 
same.

However, as obvious as that sounds on the surface, I actually think filepro 
is saner the way it is.

The reason is that, How is filepro to know that this time you want an 
expression to evaluate out one way, and another time you want an expression 
to evaluate out another way?

chr() is just an expression and after it's evaluated the result is just a 
string, like any other string.

We know foo("this IS a string")  will not treat the "IS" any different than 
the "is" in "this"

So replace the litteral with an expression:
foo("this"<chr("73"){chr("83")<"a string")

Well, foo() just sees "this IS a string"
There is no metadata attached to each character so that foo() can know that 
one of those characters was the result of evaluating a chr() vs a dummy vs a 
litteral vs any other type of expression.

Brian K. White  --  brian at aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro  BBx    Linux  SCO  FreeBSD    #callahans  Satriani  Filk!




More information about the Filepro-list mailing list