SELECT * from Test WHERE CHRTRAN(cName,' ','') = "GAMMARES">
SET EXACT OFF (the default) "ABC" = "ABCD" && .F. "ABCD" = "ABC" && .T.Why? The compare algorythm is;
1) Assume equality 2) Comapre one character at a time until the string on the right is exhausted 3) Return the resultThis causes "A" = "A" Yes "B" = "B" yes "C" = "C" yes, the stirng on the right is exhausted so they are =
SET EXACT ON "ABC" = "ABDC" && .F. "ABCD" = "ABC" && .F.Algorythm:
1) Assume equality 2) Append spaces to the shorter string until they are equal lenght 3) comapre one character at a time 4) return the resultnow for the third possibility
SET EXACT ON or OFF "ABC" == "ABCD" && .F. "ABCD" == "ABC" && .F.You might thinkj this is the same as SET EXACT ON, but it is not, the algorythm;
1) assume equality 2) comapre one character at a time until the shorter strong is exhausted 3) compare string lenghts 4) return the resultSo how they different ?
lcVar1 = "ABC " lcVar2 = "ABC" SET EXACT ON ? lcVar1 = lcVar2 && .T. because the only diff is trailing spaces ? lcVar1 == lcVar2 && .F., becuase they are not the same lengthThe ONLY way to get an exact comparison of two strings is to use the ==, SET EXACT ON does not give an exact comparison.