Kbase 19518: Function to Return Number of Decimal Places in Variable
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  09/02/2000 |
|
The following user defined function was submitted by a customer.
This function accepts a decimal value as input and returns the number of decimal places. This function will work no matter what character is used for the decimal point.
FUNCTION DecimalPlaces RETURNS INTEGER (INPUT decValue AS DEC):
DEFINE VARIABLE intValue AS INTEGER NO-UNDO INIT 0.
IF decValue <> INT(decValue) THEN
ASSIGN intValue = LENGTH(STRING(decValue)) -
LENGTH(STRING(INT(decValue))) - 1.
RETURN intValue.
END FUNCTION.