Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Len function
Message
De
03/04/2001 17:05:01
 
 
À
03/04/2001 16:48:29
Randy Hooper
Ranco Business Software
Tampa, Floride, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00491547
Message ID:
00491564
Vues:
9
Randy,

One 'gotcha', if you will, is that if you ever run into a situation where someone embeds a TAB the RTRIM, LTRIM or ALLTRIM command will not remove the TAB character.

Try the following:

x=space(1)+chr(9)+space(1)+"Hello"+space(1)+chr(9)+space(1)
y=alltrim(x)
?asc(right(y,1))

? len(y) = 9

You will get a 9 returned, which is the length up to both TAB characters. In the example above you would still have white space characters in your variable both before and after the actual information, should you only want "hello".

Sometimes users can really goof up our best laid plans. <g>

I've had, on occassion, to write a routine that 'scrubs' TABS off of variables.


>>I'm not sure I understand.
>>
>>Will LEN(RTRIM(field)) work for you? Are you looking for the length without trailing spaces?
>>
>>--Brad
>
>That will do it. Thanks
Best,


DD

A man is no fool who gives up that which he cannot keep for that which he cannot lose.
Everything I don't understand must be easy!
The difficulty of any task is measured by the capacity of the agent performing the work.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform