Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String Size
Message
From
31/05/1997 02:25:26
 
 
To
30/05/1997 22:07:38
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
User groups
Title:
Miscellaneous
Thread ID:
00034254
Message ID:
00034355
Views:
43
>>>>>>>I need to return the size of a character string in bytes. Is there any function that can help me accomplish this task. I've tried _STRLEN() API but i can't seem to get the correct syntax.
>>>>>>>
>>>>>>>Any help is greatly appreciated!
>>>>>>>Thank in advance
>>>>>>
>>>>>>Just check field length: for characted field size=length, e.g. if length=12, size=12 bytes.
>>>>>
>>>>>One addition, if it's not field but character variable use LEN() function to return length=size.
>>
>>Sorry about the other message, but I pressed send by mistake... and Michel doesn't let us to make 2 replies to the same message!
>>
>>Why "if it's not field but character variable..."?!
>>
>>Vlad
>
>strlen = len(string) ie : len(" a string ") returns 10 including left and right trailing spaces. If needed you eliminate trailing spaces with ltrim(), rtrim() or trim(), alltrim().
>if you are asking for a field variable ie: Cust_name, len(cust_name) equals to the size of field, same as fsize("cust_name"). In this case you could use len(trim(cust_name)) to remove trailing spaces to get the entered value's length (rarely you need alltrim()). And finally values returned are equal to size in bytes (use c versions ie: lenc() if using double byte characters).
>Cetin

I'm sorry, but I really don't see where's the difference. BTW, Len() works fine for memo fields also.

Vlad
Previous
Reply
Map
View

Click here to load this message in the networking platform