Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A little tip
Message
De
07/09/2003 09:40:48
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
06/09/2003 18:36:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00826775
Message ID:
00826854
Vues:
25
>Hi Hilmar,
>
>> LEFT() is unrealiable in this case
>
>If you found a SELECT example where it is unreliable, post it.
>
>I think you cannot found one.
>
>Otherwise you think that I would have written this?
>
>Fabio

As I said, for variable-length expressions.
FullName = padr("Zonneveld, Hilmar", 30) && to emulate a field
? left(alltrim(fullname), 5)
? len(left(alltrim(fullname), 5)) && 5, as expected

FullName = space(30)
? left(alltrim(fullname), 5)
? len(left(alltrim(fullname), 5)) && length zero
The resulting variable length can cause problems in some cases, like indexing. In your SELECT example, if the first record in the table happens to be empty, the length of the resulting expression will cause problems.

I have no objection to using left() (or right(), or substr()) with fixed-length expressions. It is only for variable-length expressions that I use padr(), in certain cases, to ensure that the result has a fixed-length.

For me, these cases typically include: selection of data that includes alltrim(); alignment of data in reports.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform