Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
A little tip
Message
From
07/09/2003 09:40:48
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
06/09/2003 18:36:40
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00826775
Message ID:
00826854
Views:
26
>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)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform