It is currently Fri Jul 19, 2019 4:45 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: FindString Case BUG?
PostPosted: Thu Jun 06, 2019 1:50 pm 
Offline
User
User

Joined: Sun Jul 24, 2016 11:54 pm
Posts: 38
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!


Top
 Profile  
Reply with quote  
 Post subject: Re: FindString Case BUG?
PostPosted: Thu Jun 06, 2019 2:35 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1628
Location: Germany
Many users have already complained about the seemingly FindString() error. But - like you - they have simply forgotten the 3rd parameter:

PureBasic reference for FindString() wrote:
Position = FindString(String$, StringToFind$ [, StartPosition [, Mode]])

After adding the StartPosition 1 your code works correctly:
Code:
a$="TEST.Server":m$="server"
Debug FindString(a$,m$, 1, #PB_String_CaseSensitive) ; 0
Debug FindString(a$,m$, 1, #PB_String_NoCase)        ; 6


Top
 Profile  
Reply with quote  
 Post subject: Re: FindString Case BUG?
PostPosted: Thu Jun 06, 2019 3:30 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sun Jun 22, 2003 7:43 pm
Posts: 391
Location: Germany, Saarbrücken
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.

_________________
Electronics, Crazy & Interesting Stuff, all that with text, image and sound? Click here!

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.


Top
 Profile  
Reply with quote  
 Post subject: Re: FindString Case BUG?
PostPosted: Thu Jun 06, 2019 8:27 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3598
Location: Berlin, Germany
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. :twisted:

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups


Top
 Profile  
Reply with quote  
 Post subject: Re: FindString Case BUG?
PostPosted: Fri Jun 07, 2019 3:01 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 18, 2019 8:17 am
Posts: 195
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.

Top
 Profile  
Reply with quote  
 Post subject: Re: FindString Case BUG?
PostPosted: Fri Jun 07, 2019 5:34 am 
Offline
Addict
Addict
User avatar

Joined: Sat Feb 13, 2010 3:45 pm
Posts: 861
BarryG wrote:
Maybe the two parameters could be swapped (flag first, optional start position second)

Bad idea. Flags are always the last parameter.

_________________
sorry for my bad english


Top
 Profile  
Reply with quote  
 Post subject: Re: FindString Case BUG?
PostPosted: Fri Jun 07, 2019 5:51 am 
Offline
Addict
Addict
User avatar

Joined: Thu Jun 07, 2007 3:25 pm
Posts: 3598
Location: Berlin, Germany
BarryG wrote:
Maybe the two parameters could be swapped (flag first, optional start position second) to avoid this?

That would break a lot of existing code.
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.

_________________
Please excuse my flawed English. My native language is PureBasic.
Search
RSBasic's backups


Top
 Profile  
Reply with quote  
 Post subject: Re: FindString Case BUG?
PostPosted: Fri Jun 07, 2019 8:36 am 
Offline
Enthusiast
Enthusiast

Joined: Thu Apr 18, 2019 8:17 am
Posts: 195
Josh wrote:
Bad idea. Flags are always the last parameter.

Good point! Forgot I spoke. :oops:


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 19 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye