On Thu, 12 Feb 2009, Mindaugas Kavaliauskas wrote:

Hi Mindaugas,
> 3 Well a can not even understand the third choice. The truth is, that still 
> do not understand string comparison in Clipper, but very well understand 
> strcmp() behaviour.

So you can think about:

   ( <cVal1> <op> <cVal2> )

where <op> is <, <=, >, >=, = as:

   ( strncmp( <cVal1>, <cVal2>, strlen( <cVal2> ) ) <op> 0 )

in C code. The results are exactly the same.
Of course as long as you will not try to enable SET EXACT ON which makes
the string comparison really strange for someone who does not know the
exact semantic.
For me the standard string comparison is simple, natural and very usable,
f.e.:
   SET FILTER TO FIELD->ART_CODE >= "B" .and. FIELD->ART_CODE <= "E"
all articles with code starting on letters: B, C, D, E.
It's much faster then using LEFT() function. Personally I would like to
add switch for compiler to generate PCODE which will not depend on
_SET_EXACT switch. It can greatly help in core code or library code
developing because we will not have to add workarounds for _SET_EXACT.
BTW in rtl/listbox.prg we have _SET_EXACT and this peace of code is
not Clipper compatible because enabling _SET_EXACT does not replicate
the "exact" Clipper comparison used in this code. It should be fixed.

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to