[Implemented] #PB_String_NoCase for FindString()
Posted: Sat Oct 11, 2008 1:24 am
Please add flag "#PB_String_NoCase" for FindString() function.
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
FindString(LCase(S.s), LCase(S.s), 0)
FindString(S.s, S.s, 0, #PB_String_NoCase)
Code: Select all
FindString(LCase(S.s), LCase(S.s), 0)
FindString(S.s, S.s, 0, #PB_String_NoCase)
Code: Select all
FindString(LCase(S.s), LCase(S.s), 0)
FindString(S.s, S.s, 0, 1)
This is true for characters A-Z and a-z, respectively. Maybe also for some special characters, but certainly not for all of them. Many languages have special characters, such as our funny German umlauts. And the situation is even different with Unicode.Kaeru Gaman wrote:a #PB_String_NoCase would mean that one bit is ignored while comparing.
(capital letters have bit5 cleared, small have bit5 set, the rest is identical for both alphabets.)
Sorry, but that would be a complete disaster, even in ascii mode. In Unicode mode it will be worse...Kaeru Gaman wrote:a #PB_String_NoCase would mean that one bit is ignored while comparing.
Code: Select all
; IDE: Plain text source code
; Compiler: ascii mode
Procedure.s CompareIgnoreBit6(S1.s, S2.s)
If Len(S1) <> Len(S2)
ProcedureReturn "wrong length"
EndIf
For I = 1 To Len(S1)
C1.c = Asc(Mid(S1, I, 1)) & %11011111
C2.c = Asc(Mid(S2, I, 1)) & %11011111
If C1 <> C2
ProcedureReturn "NOT equal at " + Str(I)
EndIf
Next
ProcedureReturn "equal"
EndProcedure
Debug CompareIgnoreBit6("ABCDEF", "abcdef")
Debug CompareIgnoreBit6("ABCDEF", "aBcDeF")
Debug CompareIgnoreBit6("ABCDEF", "MNBVDE")
Debug CompareIgnoreBit6("ABCDEF", "ABCVDE")
Debug "Everything was ok so far..."
Debug "----"
S1.s = "{8 × 2 ^ 10] Ÿ ß"
S2.s = "[8 ÷ 2 ~ 10} ¿ ÿ"
Debug S1
Debug S2
Debug CompareIgnoreBit6(S1, S2) + "!?!?!"