C5_VAL

 VAL() 
 Convert a character number to numeric type
------------------------------------------------------------------------------
 Syntax

     VAL(<cNumber>) --> nNumber

 Arguments

     <cNumber> is the character expression to be converted.

 Returns

     VAL() returns <cNumber> converted to a numeric value including decimal
     digits.

 Description

     VAL() is a character conversion function that converts a character
     string containing numeric digits to a numeric value.  When VAL() is
     executed, it evaluates <cNumber> until a second decimal point, the first
     non-numeric character, or the end of the expression is encountered.
     Leading spaces are ignored.  When SET FIXED is ON, VAL() returns the
     number of decimal places specified by SET DECIMALS, rounding <cNumber>
     if it is specified with more digits than the current DECIMALS value.  As
     with all other functions that round, digits between zero and four are
     rounded down, and digits between five and nine are rounded up.  When SET
     FIXED is OFF, VAL() returns the number of decimal places specified in
     <cNumber>.

     VAL() is the opposite of STR() and TRANSFORM(), which convert numeric
     values to character strings.

 Examples

     .  These examples illustrate VAL() with SET FIXED ON and SET
        DECIMALS TO 2:

        SET DECIMALS TO 2
        SET FIXED ON
        //
        ? VAL("12.1234")         // Result:   12.12
        ? VAL("12.1256")         // Result:   12.13
        ? VAL("12A12")           // Result:   12
        ? VAL("A1212")           // Result:      0
        ? VAL(SPACE(0))          // Result:      0
        ? VAL(SPACE(1))          // Result:      0
        ? VAL(" 12.12")          // Result:   12.12

 Files   Library is CLIPPER.LIB.

See Also: ROUND() SET DECIMALS SET FIXED STR() TRANSFORM()



One response to “C5_VAL

  1. Pingback: C5_SET FIXED | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.