Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ATLINE() bug and workaround?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00138760
Message ID:
00138789
Vues:
17
Hi Rick,

I know you don't like this, but that's really by design. BTW, ATLINE() does exist for quite a long time now, maybe you mix it up with ALINE()?

Anyway, ATLINE() depends on the same mechanism as MLINE() and the help file for MLINE() states:

"MLINE( ) trims any trailing spaces from the line specified with nLineNumber."

The reason here is that they can do word wrapping and therefore remove the blank between words when a new line starts.

To get all lines that end with a certain you can use ATLINE() to determine the line that includes this word, and then use RAT() and MLINE() to verify that it's indeed the last word in this particular line.

Christof


>VFP 6.0 has a new command ATLINE and ATCLINE which is nice for qiuckly getting to a line in a string. This is handy if you need to line based parsing of strings.
>
>Unfortunately there's a bug (feature?) that causes ATLINE to fail if you look for strings that contain CHR(13) or for strings at the end of a line that have trailing spaces:
>
>lcText = "Hi..." + CHR(13)+"Hello World  "+CHR(13)+"!"
>? ATCLINE("World ",lcText)
>
>lcText = "Hi..." + CHR(13)+"Hello World  "+CHR(13)+"!"
>? ATCLINE("World"+CHR(13),lcText)
>
>Both of the above fail making it impossible to search for an exact
>match that may occur at the end of a line.
>
>Ok, so that's out. Any suggestions on how you could do this
>efficiently? I need to get a line number into a string in order
>to be able to go forward and backwards through the file. Parsing
>with MLINE won't work either, because it'll never retrieve a
>CHR(13) either.
>
>Any ideas how else to get a line pointer?
>
>+++ Rick ---
--
Christof
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform