Freigeben über


STR( ) Function

Returns the character equivalent of a specified numeric expression.

STR(nExpression [, nLength [, nDecimalPlaces]])

Return Values

Character

Parameters

  • nExpression
    Specifies the numeric expression STR( ) evaluates.

  • nLength
    Specifies the length of the character string STR( ) returns. The length includes one character for the decimal point and one character for each digit to the right of the decimal point.

    STR( ) pads the character string it returns with leading spaces if you specify a length larger than the number of digits to the left of the decimal point. STR( ) returns a string of asterisks, indicating numeric overflow, if you specify a length less than the number of digits to the left of the decimal point.

    If nExpression is of numeric or float type, STR( ) returns a value using scientific notation if nLength is less than the number of digits in nExpression. If nExpression is an integer, STR( ) returns a string of asterisks, indicating numeric overflow, if nLength is less than the number of digits in nExpression.

    If nLength isn't included, the length of the character string defaults to 10 characters.

  • nDecimalPlaces
    Specifies the number of decimal places in the character string STR( ) returns. You must include nLength to specify the number of decimal places.

    If you specify fewer decimal places than are in nExpression, the return value is rounded up.

    If nDecimalPlaces isn't included, the number of decimal places defaults to zero.

See Also

VAL( ) | Creating Numeric Expressions | STRCONV( ) Function