Thank you for your comments.

I missed the finer point.

Code: Select all
CompilerIf #PB_Compiler_Debugger:CompilerError "Turn OFF debugger for Speed Tests!":CompilerEndIf
s1$ = "hello!": #s = "HELLO!": s2$ = #s
Macro StrCmp(str1, str2, UseCase=#PB_String_NoCase)
Bool(CompareMemoryString(@str1, @str2, UseCase) = #PB_String_Equal)
EndMacro
Macro StrCmpLC(str1, str2, UseCase=#PB_String_NoCase)
Bool(LCase(str1) = LCase(str2))
EndMacro
Procedure StrCmpP(a$, b$)
ProcedureReturn Bool(CompareMemoryString(@a$, @b$, #PB_String_NoCase) = #PB_String_Equal)
EndProcedure
nTries = 1e6
t = ElapsedMilliseconds()
For L = 1 To nTries
StrCmp(s1$, s2$)
Next
MessageRequester("Fastest", "CompareMemoryString using string variable -> " + Str(ElapsedMilliseconds() - t) + "ms")
t = ElapsedMilliseconds()
For L = 1 To nTries
StrCmpLC(s1$, #s)
Next
MessageRequester("Slower", "LCase() = LCase() -> " + Str(ElapsedMilliseconds() - t) + "ms")
t = ElapsedMilliseconds()
For L = 1 To nTries
StrCmpP(s1$, #s)
Next
MessageRequester("Slowest", "Procedure+CompareMemoryString enabling use of string #const -> " + Str(ElapsedMilliseconds() - t) + "ms")
Nope. I modified your example to show why:TI-994A wrote: Wed Jul 24, 2013 3:18 amperhaps you could make use of PureBasic's FindString() function with the #PB_String_NoCase flag
Code: Select all
s1$ = "hello said! - but this is different"
s2$ = "HELLO Said!"
If FindString(s1$, s2$, 1, #PB_String_NoCase)
result$ = "The two strings match!" ; This will be the result. :)
Else
result$ = "The two strings don't match."
EndIf
MessageRequester("Case Insensitive String Compare", result$)
idle wrote: Wed Nov 16, 2022 12:56 am simple and full case folding string cmp
viewtopic.php?t=80128
https://dnscope.io/idlefiles/casefold.pb
Code: Select all
EnableExplicit
Import ""
_wcsicmp.i(*str1,*str2)
EndImport
Macro CompareString(_str1_,_str2_)
Bool(_wcsicmp(_str1_,_str2_) = 0)
EndMacro
Global s1.s = "Hello World!"
Global s2.s = "HELLO WORLD!"
Debug CompareString(s1,s2)
Debug CompareString(@s1,@s2)
s2 = ":)"
Debug CompareString(s1,s2)
Debug CompareString(@s1,@s2)
Debug CompareString(":)",s2)
End
idle wrote: Wed Nov 16, 2022 12:56 am simple and full case folding string cmp
viewtopic.php?t=80128
https://dnscope.io/idlefiles/casefold.pb
Ok, then doesn't work on x86Mijikai wrote: Wed Nov 16, 2022 7:42 pm I used PB 6.00 x64 - the function is part of the crt lib.
Unless i updated it manually it should work out of the box.
Oh, I didn't realise that. I saw your post (which resurrected the thread) and therefore mistakenly thought this was a current topic, including the post that I replied to. I don't check the dates of posts before replying because my board prefs are set to only show me new posts since my last visit.
Thanks, I was just trying to link the topic for search purposes and then got exasperated by all the replies.BarryG wrote: Thu Nov 17, 2022 8:26 amOh, I didn't realise that. I saw your post (which resurrected the thread) and therefore mistakenly thought this was a current topic, including the post that I replied to. I don't check the dates of posts before replying because my board prefs are set to only show me new posts since my last visit.
My comment is still valid regardless though, as a demonstration of why TI-994A's approach won't work.