Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with ATC()?
Message
From
29/08/2001 16:04:15
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Problem with ATC()?
Miscellaneous
Thread ID:
00550537
Message ID:
00550537
Views:
51
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
Next
Reply
Map
View

Click here to load this message in the networking platform