Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
PADL() has a nice undocumented feature
Message
De
23/02/2006 02:42:22
Al Doman (En ligne)
M3 Enterprises Inc.
North Vancouver, Colombie Britannique, Canada
 
 
À
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:
01098379
Vues:
12
>>This is to let you all know that I discovered a really nice, undocumented feature of PADL(). It is present in at least vfp7 and higher.
>>
>>The 3rd parameter can be used to define the Pad Character, says the doc. However, this parameter can be of varying length! An example:
>>
>>
? "Result: " + padl( 123, 10, "#000000000" )
>>Result: #000000123
>
>It is a doc error.
>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 "_#_#_"
>
Just out of interest - why would you expect "_#_#_" for PADR()? A general symmetry argument? If so, I would "expect" PADL() to yield "_#_#_" and PADR() to yield "#_#_#".
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform