Page 1 of 1
[6.12 LTS - Win x64] FindString() - False Result
Posted: Tue Dec 10, 2024 9:57 pm
by troof
Code: Select all
txt$ = "what-the-foo"
count = FindString(txt$,"-")
Debug count
Result = 5 [false]
Code: Select all
txt$ = "Iiiii-like-purebasic"
count = FindString(txt$,"-")
Debug count
Result = 6 [false]
Error seems to be in first string part:
Code: Select all
txt$ = "w-the-foo"
count = FindString(txt$,"-")
Debug count
Result = 2 [true]
Code: Select all
txt$ = "I-like-purebasic"
count = FindString(txt$,"-")
Debug count
Result = 2 [true]
Cheers
Re: [6.12 LTS - Win x64] FindString() - False Result
Posted: Tue Dec 10, 2024 10:06 pm
by BarryG
troof wrote: Tue Dec 10, 2024 9:57 pm
Code: Select all
txt$ = "what-the-foo"
count = FindString(txt$,"-")
Debug count
Result = 5 [false]
Why is that false? The first dash is indeed position 5. Not a bug.
Re: [6.12 LTS - Win x64] FindString() - False Result
Posted: Tue Dec 10, 2024 10:10 pm
by troof
Sorry, I confused CountString with FindString.

I have problems to switch between programming in javascript and purebasic.
it's too different - and i'm getting old.
Re: [6.12 LTS - Win x64] FindString() - False Result
Posted: Wed Dec 11, 2024 12:15 am
by idle
troof wrote: Tue Dec 10, 2024 10:10 pm
Sorry, I confused CountString with FindString.

I have problems to switch between programming in javascript and purebasic.
it's too different - and i'm getting old.
Easy enough to confuse, generally post in questions before bugs as it's often the case of users error than bug.
and opps I just sent a pm for the same reason of getting old! clicked the wrong button!

Re: [6.12 LTS - Win x64] FindString() - False Result
Posted: Wed Dec 11, 2024 1:08 am
by Olli
The big difference between javascript and purebasic, it is the speed.
I think you can search a byte code in 100 megabytes in javascript, while you can search a byte code in one gigabyte in purebasic.
This difference can bring some motivation to learn. Here is a clock which details about the time resolution in purebasic.
Code: Select all
Procedure CLK()
! RDTSC
ProcedureReturn
EndProcedure
Debug CLK()
Debuh CLK()
Re: [6.12 LTS - Win x64] FindString() - False Result
Posted: Wed Dec 11, 2024 4:36 pm
by SPH
Olli :
"debuh" = error
Re: [6.12 LTS - Win x64] FindString() - False Result
Posted: Wed Dec 11, 2024 8:25 pm
by PBJim
Olli wrote: Wed Dec 11, 2024 1:08 am
Here is a clock which details about the time resolution in purebasic.
Code: Select all
Procedure CLK()
! RDTSC
ProcedureReturn
EndProcedure
Debug CLK()
Debuh CLK()
I'm interested in how the clock counter is being returned by ProcedureReturn.
Re: [6.12 LTS - Win x64] FindString() - False Result
Posted: Wed Dec 11, 2024 9:01 pm
by normeus
" ! RDTSC" places the result in edx and eax on x86 and for x64 it combines them in one register
"ProcedureReturn", as per the pb manual:
Code: Select all
If no value is specified for ProcedureReturn, the return value will be zero if the compiler uses the C backend and for all processors managed by PureBasic, or the content of the 'eax' register in 32 bits (X86 processors) or 'rax' in 64 bits (X64 processors) if the compiler uses the ASM back-end, (see for more information).
That's one thing about PB, you really have to read the manual
Norm