Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: SUBSTRING in FOR loop returns incorrect data
Message
 
 
À
27/06/2004 15:24:44
Information générale
Forum:
Visual FoxPro
Catégorie:
Visual FoxPro Beta
Divers
Thread ID:
00917754
Message ID:
00917770
Vues:
14
Hi Andrus,

It's a bug in SUBSTR() function that has nothing to do with FOR loop. You can report it to VFP Team at http://support.microsoft.com/default.aspx?scid=/support/vfoxpro/report/report.asp&sd=msdn ?
==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
>Result expected: empty messagebox
>
>code to reproduce:
>
>
>for i=1 to len(SPACE(250))/250
>  MESSAGEBOX(subs( REPLICATE('x', 250), i*250+1, 250 ))
>  endfor
>
>
>How to fix this witout changing code ?
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform