Page 1 of 1

Case insensitive search not working at FindString [invalid]

Posted: Sun Sep 03, 2017 12:58 pm
by wb2k
Edit: As Little John mentioned, Mode is the 4th parameter, so correct code would be: FindString("PureBasic", "BAS", 0, #PB_String_NoCase)

According to the manual FindString's optional parameter "Mode" allows to do a case insensitive search with #PB_String_NoCase: https://www.purebasic.com/documentation ... tring.html

However, the following code

Code: Select all

Debug FindString("PureBasic", "Bas")
Debug FindString("PureBasic", "BAS")
Debug ""
Debug FindString("PureBasic", "Bas", #PB_String_CaseSensitive)
Debug FindString("PureBasic", "BAS", #PB_String_CaseSensitive)
Debug ""
Debug FindString("PureBasic", "Bas", #PB_String_NoCase)
Debug FindString("PureBasic", "BAS", #PB_String_NoCase)
outputs

Code: Select all

5
0

5
0

5
0
So Debug FindString("PureBasic", "BAS", #PB_String_NoCase) prints out 0 where it should print out 5.

Re: [5.60] Case insensitive search not working at FindString

Posted: Sun Sep 03, 2017 1:19 pm
by Alex777
Same result here with PB 5.45 LTS x86.

Re: [5.60] Case insensitive search not working at FindString

Posted: Sun Sep 03, 2017 1:25 pm
by Little John
wb2k wrote:According to the manual FindString's optional parameter "Mode" allows to do a case insensitive search with #PB_String_NoCase: https://www.purebasic.com/documentation ... tring.html

However, the following code

Code: Select all

Debug FindString("PureBasic", "Bas")
Debug FindString("PureBasic", "BAS")
Debug ""
Debug FindString("PureBasic", "Bas", #PB_String_CaseSensitive)
Debug FindString("PureBasic", "BAS", #PB_String_CaseSensitive)
Debug ""
Debug FindString("PureBasic", "Bas", #PB_String_NoCase)
Debug FindString("PureBasic", "BAS", #PB_String_NoCase)
Please look again into the manual, and then tell us whether "Mode" is the 3rd or the 4th parameter. :mrgreen:

Re: [5.60] Case insensitive search not working at FindString

Posted: Sun Sep 03, 2017 1:33 pm
by Alex777
Ahhh! [slaps forehead] You are absolutely right. No bug there. :oops:

Re: [5.60] Case insensitive search not working at FindString

Posted: Sun Sep 03, 2017 2:11 pm
by wb2k
Little John wrote:Please look again into the manual, and then tell us whether "Mode" is the 3rd or the 4th parameter. :mrgreen:
Ohhh, should have seen this. Thanks for clarifying this!
I'm marking the original post as invalid.