==TITLE== SUBSTR() function returns incorrect result with non-integer second parameter if it's beyond the first parameter length ==STEPS TO REPRO== Run following code ------------------- CLEAR lcStr = "xxx" * 1. lcResult = SUBSTR(lcStr, LEN(lcStr)+1, 1 ) ? LEN(lcResult), lcResult * 2. lcResult = SUBSTR(lcStr, (LEN(lcStr))*1.0+1.0, 1 ) ? LEN(lcResult), lcResult lcResult = SUBSTR(lcStr, LEN(lcStr)+1000.0, 1 ) ? LEN(lcResult), lcResult ------------------- ==OBSERVED BEHAVIOR== 1. lcResult is empty string 2. lcResult = 'x' (LEN=1) ==EXPECTED BEHAVIOR== lcResult is empty string in all cases ==COMMENTS== It works correctly in VFP8>Result occured: x
>for i=1 to len(SPACE(250))/250 > MESSAGEBOX(subs( REPLICATE('x', 250), i*250+1, 250 )) > endfor >>