Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Len function
Message
From
03/04/2001 17:05:01
 
 
To
03/04/2001 16:48:29
Randy Hooper
Ranco Business Software
Tampa, Florida, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00491547
Message ID:
00491564
Views:
10
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.
Previous
Reply
Map
View

Click here to load this message in the networking platform