Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Empty last line not recognized by ALINES()
Message
De
24/05/2003 11:52:06
 
 
À
24/05/2003 11:27:19
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00792524
Message ID:
00792554
Vues:
30
This message has been marked as the solution to the initial question of the thread.
>>Peter,
>>
>>What's the difference between
>>
>lcC = "a" + ccCRLF + "b" + ccCRLF + "c" + ccCRLF + ""
>and
>lcC = "a" + ccCRLF + "b" + ccCRLF + "c" + ccCRLF
>
>No difference.
>
>>
>>The only way to indicate an empty line is to append crlf as in
>>
>>lcC = "a" + ccCRLF + "b" + ccCRLF + "c" + ccCRLF + "" + ccCRLF
>>
> or
>lcC = "a" + ccCRLF + "b" + ccCRLF + "c" + ccCRLF + ccCRLF
>
>Suppose the last item is determined by some string variable. The result of ALINES() will differ depending on whether or not the variable is empty.
>
>
lcC = "a" + ccCRLF + "b" + ccCRLF + "c" + ccCRLF + lcSomeVar
>
>This is troublesome, also because the resulting array is redimensioned even if was originally longer. Do something like
>
dimension laLine[4]
>laLine = ''
>alines( laLine, lcC )
>? alen( laLine )
>
>The array will shrink back to 3 elements if the last line in lcC is empty.

Peter,

Why not always add crlf to the last element ?
instead of
lcC = "a" + ccCRLF + "b" + ccCRLF + "c" + ccCRLF + lcSomeVar
do
lcC = "a" + ccCRLF + "b" + ccCRLF + "c" + ccCRLF + lcSomeVar + ccCRLF
then alines() will always return 4
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform