Hello Everybody,
I am confused if this is BUG or NOT...
Is this code works normally? Or how "#PB_String_NoCase" works?
I did think #PB_String_NoCase means it finds the same string (dont care capital or not as case) But it doesnt do that...
If this is BUG Please fix this on the future release! If this is NOT BUG then what does this do?
My Sample Code:
a$="TEST.Server":m$="server"
Debug FindString(a$,m$,#PB_String_CaseSensitive)
Debug FindString(a$,m$,#PB_String_NoCase)
Thanks A LOT!
FindString Case BUG?
Re: FindString Case BUG?
Many users have already complained about the seemingly FindString() error. But - like you - they have simply forgotten the 3rd parameter:
After adding the StartPosition 1 your code works correctly:PureBasic reference for FindString() wrote:Position = FindString(String$, StringToFind$ [, StartPosition [, Mode]])
Code: Select all
a$="TEST.Server":m$="server"
Debug FindString(a$,m$, 1, #PB_String_CaseSensitive) ; 0
Debug FindString(a$,m$, 1, #PB_String_NoCase) ; 6
- NicTheQuick
- Addict
- Posts: 1227
- Joined: Sun Jun 22, 2003 7:43 pm
- Location: Germany, Saarbrücken
- Contact:
Re: FindString Case BUG?
Please don't ask questions about "bug or not" in the bug forum. Always ask in a coding forum first to make sure you did not have an error in your code.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
-
- Addict
- Posts: 4527
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: FindString Case BUG?
And maybe people could also read the related documentation before posting a "bug report"?
Yes I know, that's a strange idea, but I wanted to mention it anyway.
Yes I know, that's a strange idea, but I wanted to mention it anyway.
Re: FindString Case BUG?
I knew what this "bug" was going to be even before I read the post.
Last edited by BarryG on Fri Jun 07, 2019 8:36 am, edited 1 time in total.
Re: FindString Case BUG?
Bad idea. Flags are always the last parameter.BarryG wrote:Maybe the two parameters could be swapped (flag first, optional start position second)
sorry for my bad english
-
- Addict
- Posts: 4527
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
Re: FindString Case BUG?
That would break a lot of existing code.BarryG wrote:Maybe the two parameters could be swapped (flag first, optional start position second) to avoid this?
Such changes in a programming language should be made only for important reasons.
The fact that some people want to use a PB function without having read its documentation is NO reason for changing it.
Re: FindString Case BUG?
Good point! Forgot I spoke.Josh wrote:Bad idea. Flags are always the last parameter.