I have a program where I have a defined character set in a string constant, and that string constant contains both the double-quote character and the single-quote character (sometimes called and apostrophe).
Next I get a text input from a text field and scan through that constant using InstrB to have it tell me at which character position does a character in the input string occur.
the string constant = ABCDEFGH
and the string input = E
Then InstrB(constant,input) reruns the number 5
That is exactly as it should be.
But I have discovered that if my string constant contains a single-quote mark ( ’ ) or a double-quote mark ( " ) and I try to search for either of those characters the InstrB command will return value of 0 (as in Not Found)
I even attempted programmatically to copy the constant into a variable and search that variable … and it still won’t find either of the quote marks … but it finds other characters just fine.
And whenI have it search for characters that are after the quote marks … it finds them but reports their position incorrectly.
I wrote a program to test this:
In my test program I created a Module, and in that module I defined the constant name MyString = ABCDE"FGH’IJKL … and when I run my program, in TextField1 I enter ABCDE"FGH’IJKL (the same value that my constant is supposed to contain) … and then in TextField2 I enter the character it is supposed to search for.
[code] dim A,B,C as string
dim X,Y,Z as Integer
A = TextField1.text
B = TextField2.text
C = MyString
Label6.text = MyString
Label10.text = C
X = InstrB(A,B)
Y = InstrB(MyString,B)
Z = InstrB(C,B)
Label1.text = str(X)
Label4.text = str(Y)
Label12.text = str(Z)[/code]
When I search for the letter A … X,Y, and Z all return 1
When I search for the letter E … X,Y, and Z all return 5
When I search for a " then X=6, Y=0, and Z=0
When I search for the letter F then X=7, Y=9, and Z=9
When I search for a ’ then X=10, Y=0, and Z=0
When I search for I (capital i) then X=11, Y=15, and Z=15
I think I found a significant bug in Xojo 2015 Release 2.2 for the Mac