| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Returns the number of characters a numeric value needs for display.
LenNum( <nNumber> ) --> nLength
The function returns a numeric value. It is the number of characters required to display the numeric value, including the decimal point.
LenNum() is a utility function that calculates the number of characters a numeric value needs for display. It is an abbreviation for the expression Len( LTrim( Str( <nNumber> ) ) ).
| See also: | Len(), Str(), LTrim() |
| Category: | Numeric functions , xHarbour extensions |
| Source: | rtl\lennum.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows various results of LenNum()
PROCEDURE Main
? LenNum( 1 ) // result: 1
? LenNum( 10 ) // result: 2
? LenNum( 100 ) // result: 3
? LenNum( 1000 ) // result: 4
? LenNum( 10.1 ) // result: 4
? LenNum( 100.12 ) // result: 6
? LenNum( 1000.123 ) // result: 8
? LenNum( 0.1 ) // result: 3
? LenNum( 0.01 ) // result: 4
? LenNum( 0.001 ) // result: 5
? LenNum( 0.0001 ) // result: 6
RETURN
http://www.xHarbour.com