Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Treating lines in a variable
Message
 
À
27/09/2012 11:26:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01553736
Message ID:
01554081
Vues:
51
It works fine now

Thank you and all the other that helped me to achieve it.


Moises



>>Maybe Tore had something like this in mind?
>>
>>
>>lcNewString = ""
>>For lnX = 1 to lnLen
>>   lcNewString = lcNewString + Upper(Left(laString(lnX),1)) + substr(laString(lnX),2)  + crlf
>>ndfor
>>
>
>Exactly! Never program on an empty stomach! :-) So this should work
>lcNewString=''
>lnLen = alines(laString,lcString)
>#define crlf chr(13)+chr(10)
>For lnX = 1 to lnLen
>    lcNewString = lcNewString + Upper(Left(laString(lnX),1)) + substr(laString(lnX),2)  + crlf
>Endfor
>lcNewString = left(lcNewString, len(lcNewString-2))
>
>>>Still the same :)
>>>
>>>It works fine line by line into FOR structure but the final result inside the variable is just the last line.
>>>
>>>I wonder if lines are being replaced inside of the array or only being stored into the variable.
>>>
>>>Any comments to Tore's (valuable) code would be appreciated because it seems almost perfect.
>>>It seems to me there should be more than one new variable involved, but I not able to achieve it myself.
>>>
>>>
>>>Moises
>>>
>>>
>>>
>>>
>>>
>>>>>>>>Something like this (not tested)
>>>>>>>>lcNewString=''
>>>>>>>>#define crlf chr(13)+chr(10)
>>>>>>>>For lnX = 1 to memlines(lcString)
>>>>>>>>   lcNewString =Upper(Left(mline(lcString,lnX),1)) + substr(mline(lcString,lnX),2)  + crlf
>>>>>>>>Endfor
>>>>>>>>lcNewString = left(lcNewString, len(lcNewString-2))
>>>>>>>
>>>>>>>No
>>>>>>
>>>>>>???
>>>>>>
>>>>>
>>>>>Try a with an mline() that is longer than set('memowidth')
>>>>
>>>>OK, you're right. Then you can use alines() instead, as Tamar suggests.
>>>>lcNewString=''
>>>>lnLen = alines(laString,lcString)
>>>>#define crlf chr(13)+chr(10)
>>>>For lnX = 1 to lnLen
>>>>    lcNewString =Upper(Left(laString(lnX),1)) + substr(laString(lnX),2)  + crlf
>>>>Endfor
>>>>lcNewString = left(lcNewString, len(lcNewString-2))
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform