HB_RAT(cToken, cString, nStart, nEnd) ignores nEnd, if it is "out of bound". I feel is more natural "out of bound" string be an empty string.

Example: I want to iterate over all "/" characters from right to left.
cPath := "/aaa/bbb/ccc"
nI := LEN(cPath)
DO WHILE(nI := HB_RAT("/", cPath,, nI)) > 0
 ? nI
 nI--
ENDIF


But this is endless loop:
9
5
1
9
5
1
...


I would expect HB_RAT("/", cPath,, 0) to search "/" in a empty (zero length) substring of cPath, and thus return 0.


Does anyone has objection against such change?

No, just pls make sure new behavior is in sync with HB_AT().

[ AFAIS, HB_RAT() is currently different from HB_AT(),
in this case it should definitely be synced. ]

Brgds,
Viktor

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to