xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

LenNum()

Returns the number of characters a numeric value needs for display.

Syntax

LenNum( <nNumber> ) --> nLength

Arguments

<nNumber>
A numeric value.

Return

The function returns a numeric value. It is the number of characters required to display the numeric value, including the decimal point.

Description

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> ) ) ).

Info

See also:Len(), Str(), LTrim()
Category: Numeric functions , xHarbour extensions
Source:rtl\lennum.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe