Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PADL() has a nice undocumented feature
Message
De
23/02/2006 15:31:10
 
 
À
23/02/2006 14:00:11
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01098313
Message ID:
01098663
Vues:
15
>>Correct documentation is
>>
>>
>>PADL(eExpression, nResultSize [, cExpression])
>>
>>PADR(eExpression, nResultSize [, cExpression])
>>
>>PADC(eExpression, nResultSize [, cExpression])
>>
>>? "Result: " + padl( '', 5, "#_" ) && Result: "#_#_#"
>>
>>* The implementation have a bug
>>? "Result: " + padR( '', 5, "#_" ) && Result: "#_#_#"  Expected "_#_#_"
>>
>
>Your expectation is wrong. This is actually implemented as
>
>
stuff(left(replicate(cExpression, ceiling(nResultSize/len(cExpression)), nResultsize);
>   transform(eExpression), nResultSize-len(transform(eExpression), ;
>   len(transform(eExpression))
>
>
>I.e. VFP repeats the cExpression as needed, then trims it to nResultSize, then stuffs the eExpression in its left, middle or right.

Dragan, i known as it is implemented,
I say only that PADR() is not implemented as I would have implemented it
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform