home *** CD-ROM | disk | FTP | other *** search
- * Function: Truncate()
- * Author: A. Timothy Wong
- * Version: Clipper Summer '87
- * Note(s): Truncates a number at a certain decimal place.
- *
- * Copyright (C) 1988 Nantucket Corp.
-
- FUNCTION Truncate
- PARAMETERS Number, DecPlaces
- PRIVATE RetVal, NStr, Temp1, Temp2
-
- NStr = STR(Number)
- Temp1 = AT(".",NStr) && Position of decimal point.
- Temp2 = LEN(NStr) - Temp1 && Find total decimal places.
- DecPlaces = MIN(Temp2,DecPlaces) && if Total decimal places is
- ** less than needed.
- RetVal = VAL(SUBSTR(NStr,1,Temp1 + DecPlaces))
-
- RETURN(RetVal)