Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PADL() has a nice undocumented feature
Message
De
23/02/2006 14:00:11
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
23/02/2006 02:32:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01098313
Message ID:
01098624
Vues:
16
>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.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform