FindString bug

Just starting out? Need help? Post your questions and find answers here.
User avatar
kpeters58
Enthusiast
Enthusiast
Posts: 341
Joined: Tue Nov 22, 2011 5:11 pm
Location: Kelowna, BC, Canada

FindString bug

Post by kpeters58 »

5.42 64bit Windows:

This returns 0

Code: Select all

Debug FindString("Inkl. Adress-Daten", "adress", #PB_String_NoCase)
and this does not

Code: Select all

Debug FindString("Inkl. Adress-Daten", "Adress", #PB_String_NoCase)
Clearly both should find it.
PB 5.73 on Windows 10 & OS X High Sierra
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: FindString bug

Post by RASHAD »

The position parameter must be used

Code: Select all

Debug FindString("Inkl. Adress-Daten", "adress",0, #PB_String_NoCase)
Egypt my love
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: FindString bug

Post by Little John »

RASHAD wrote:The position parameter must be used
Yes, but
[u]Reference Manual[/u] wrote:The first character index is 1.
:-)

Code: Select all

Debug FindString("Inkl. Adress-Daten", "adress", 1, #PB_String_NoCase)
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: FindString bug

Post by RASHAD »

Hi LJ
In that case you can consider 0 as
If this parameter isn't specified, the whole string is searched.
:P
Egypt my love
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: FindString bug

Post by ts-soft »

RASHAD wrote:Hi LJ
In that case you can consider 0 as
If this parameter isn't specified, the whole string is searched.
I would use #PB_Any in this case, but all is working :wink:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: FindString bug

Post by Little John »

RASHAD wrote:In that case you can consider 0 as
If this parameter isn't specified, the whole string is searched.
I don't think so.
"If this parameter isn't specified" means, if you write something like

Code: Select all

Debug FindString(String$, StringToFind$)
In your code above, you did specify the third parameter (= passed the value 0 for it).
The third parameter specifies the start position, but there is no 0th start position.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4636
Joined: Sun Apr 12, 2009 6:27 am

Re: FindString bug

Post by RASHAD »

First of all logically the position must be specified to count the occurrence of the target from
The manual said the first position is 1 and that we can call a specified position
0 (Null) Means not specified
It can not be Void while there is some other parameter we can use
Egypt my love
Post Reply