#PB_String_NoCase does not have any effect in 6.00 C

Just starting out? Need help? Post your questions and find answers here.
User avatar
darius676
Enthusiast
Enthusiast
Posts: 278
Joined: Thu Jan 31, 2019 12:59 am
Contact:

#PB_String_NoCase does not have any effect in 6.00 C

Post by darius676 »

:)

#PB_String_NoCase does not have any effect in 6.00 C
Str(FindString("TEST_STRING_Xbox","XB", #PB_String_NoCase)

OS: Win 11 64 Bit
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: #PB_String_NoCase does not have any effect in 6.00 C

Post by mk-soft »

Already had a thousand times :!: :mrgreen:

s1.s = Str(FindString("TEST_STRING_Xbox","XB", -1, #PB_String_NoCase) )
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Little John
Addict
Addict
Posts: 4519
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: #PB_String_NoCase does not have any effect in 6.00 C

Post by Little John »

mk-soft wrote: Tue Feb 07, 2023 7:11 pm Already had a thousand times :!: :mrgreen:

s1.s = Str(FindString("TEST_STRING_Xbox","XB", -1, #PB_String_NoCase) )
The 3rd parameter is the start position. -1 doesn't make sense. A value between 1 and the length of the string used as 1st parameter should be entered as start position.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: #PB_String_NoCase does not have any effect in 6.00 C

Post by mk-soft »

True,

where was that '-1' thing again that was always forgotten?
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
darius676
Enthusiast
Enthusiast
Posts: 278
Joined: Thu Jan 31, 2019 12:59 am
Contact:

Re: #PB_String_NoCase does not have any effect in 6.00 C

Post by darius676 »

Position = FindString(String$, SearchFor$ [, StartPosition [, Modus]])
Why does:

Str(FindString("TEST_STRING_Xbox","XB", #PB_String_NoCase)

not work as shwon in the manual?
Is this a bug of the compiler or the manual, or... in my head? :)

I changed the string$ using UCase(string.s), now it works.

I am just asking: did I miss something in the manual or is there a logc bug in my mind?
infratec
Always Here
Always Here
Posts: 6817
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: #PB_String_NoCase does not have any effect in 6.00 C

Post by infratec »

You have to read more carefully:
#PB_String_NoCase
is the modus.

Where is your StartPosition :?:

More precise: you use it as StartPosition.
This is your fault.
User avatar
darius676
Enthusiast
Enthusiast
Posts: 278
Joined: Thu Jan 31, 2019 12:59 am
Contact:

Re: #PB_String_NoCase does not have any effect in 6.00 C

Post by darius676 »

Hello, thank you for your feedback:
the startposition is optional, you can give this function a startposition, but you dont have to.
it works without the optional #PB_String_NoCase, if the search string is part of the string (case sensitive), but if you do use #PB_String_NoCase, no string/part is found...

As I used UCase(), everything worked fine...

Here the german part of the manual:

Position = FindString(String$, SuchString$ [, StartPosition [, Modus]])
Beschreibung

Versucht den 'Suchstring$' im angegebenen 'String$' zu finden.
Parameter

String$ Der zu verwendende String.
SuchString$ Der zu suchende String.
StartPosition (optional) Die Startposition, um mit der Suche zu beginnen. Der Index des ersten gültigen Zeichens lautet 1. Wird dieser Parameter nicht angegeben, dann wird der gesamte String durchsucht.
Modus (optional) Dies kann einer der folgenden Werte sein:
#PB_String_CaseSensitive: Suche unter Beachtung der Groß-/Kleinschreibung ("case sensitive", (a=a)) (Standard).
#PB_String_NoCase : Suche ohne Beachtung der Groß-/Kleinschreibung (A=a).



Rückgabewert

Gibt die Position (in Zeichen) des zu suchenden Strings zurück, oder Null wenn der String nicht gefunden wurde. Der Index des ersten Zeichens lautet 1.
Debug FindString("PureBasic", "Bas") ; wird 5 ausgeben

Unterstützte OS

Alle
User avatar
darius676
Enthusiast
Enthusiast
Posts: 278
Joined: Thu Jan 31, 2019 12:59 am
Contact:

Re: #PB_String_NoCase does not have any effect in 6.00 C

Post by darius676 »

Oh shit, now I see.....what a shame.....
thank you all for your help, it was too late, too much...
User avatar
Demivec
Addict
Addict
Posts: 4086
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: #PB_String_NoCase does not have any effect in 6.00 C

Post by Demivec »

mk-soft wrote: Tue Feb 07, 2023 10:19 pm True,

where was that '-1' thing again that was always forgotten?
The other is typically PeekS(*MemoryBuffer [, Length [, Format]]) with Length as -1.
Post Reply