Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with ATC()?
Message
De
29/08/2001 16:32:29
Gerry Schmitz
GHS Automation Inc.
Calgary, Alberta, Canada
 
 
À
29/08/2001 16:04:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00550537
Message ID:
00550556
Vues:
12
>I've been struggling since 1100am today on this...
>
>Please excuse the present state of the code, but it is this way after many attempted variations.
>
>Until 10 minutes ago I was using the following:
>
m.X3 = ATC(m.OnlyWords,  ;
>          SUBSTR(This.MessageContent[This.MessageDetail[m.X2,1]],  ;
>                 This.MessageDetail[m.X2, 4],  ;    && paragraph start
>                 This.MessageDetail[m.X2, 5]), 1)   && paragraph length
>
>The above ATC() returned a non-zero value in the first pass, for a string of 210 characters, but ALWAYS returned 0 for a string (that happened to be) of 672 characters.
>
>Finally I gave up and tried an alternative, as follows:
>
IF SUBSTR(This.MessageContent[This.MessageDetail[m.X2,1]],  ;
>          This.MessageDetail[m.X2, 4]+This.MessageDetail[m.X2, 8],  ;    && paragraph start
>          This.MessageDetail[m.X2, 5]-This.MessageDetail[m.X2, 8])  ;    && paragraph end
>     <> m.OnlyWords
>ENDIF
>
>This returned .F., indicating that the two comparands were equal!
>I put the m.OnlyWords varaible last because it will often be shorter than the substring extract.
>The reason for the added "+/- This.MessageDetail[m.X2, 8]" is to bypass any specific characters that might be at the start of the extracted string. In this case there were none, but subsequently there are.
>
>The reason that I used the ATC() function was to avoid having to make allowance for the specific leading characters in the extracted portion and to make the sometimes shorter m.OnlyWords findable even if the other is longer.
>
>I will get along with the comparison now, but feel that there is a bug in ATC(). Anyone know if there is?
>
>PS I Put this in VFP7 topic but the ATC() performed exactly the same in VFP6.
>
>JimN

This code is showing definite signs of desperation.

I would use intermediate variables (instead of array accesses), display the contents, and rerun the code in question. I would even use "constants" (temporarily) if need be.

There may be nothing wrong with the code; it might be the data (which may not be what you think it is).
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform