GetLatestVersion

Len()

This function tells you how long a string is.

Usage

nStringLength = LEN( cString )
That's it, just the length of the string you pass it.

Except for one thing. There's a gotcha when you use LEN() on a character field (it works fine on memo fields). Fields in FoxPro are fixed-length, so strings that don't fill the allocated space get filled with trailing blanks. When you apply LEN() to a character field, you get back the defined size of the field, not the size of the actual contents. Apply TRIM() or ALLTRIM() before LEN() if you want to know how many characters you've actually put in a field.

Like most of the string-handling functions, LEN() has a double-byte alternative, LENC(), useful for handling strings in languages that have larger character sets.

Example

? LEN("abcdef")      && returns 6 ? LEN(LastName)      && returns defined length of LastName field ? LEN(TRIM(LastName)) && returns length of LastName for                        && current record

See Also

AllTrim(), FSize(), LenC(), Trim()


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net