home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST16.PRG < prev    next >
Encoding:
Text File  |  1989-08-08  |  848 b   |  32 lines

  1. ********************
  2.  
  3. FUNCTION Fill_zeros
  4.  
  5.    PARAMETER _clipnumb, _slength
  6.  
  7.    IF PCOUNT() = 0
  8.       RETURN("")
  9.    ELSEIF PCOUNT() = 1
  10.       _slength = 10
  11.    ENDIF
  12.    _clipnumb = IF(TYPE("_clipnumb") = "C", VAL(_clipnumb), _clipnumb)
  13.    
  14.    * This function padds the left of the number with the appropriate
  15.    * number of zeros...
  16.  
  17.    _newnumb = LTRIM(TRIM(STR(_clipnumb)))
  18.    IF _slength > 0                               && Positive Number
  19.       DO WHILE LEN(_newnumb) != _slength
  20.          _newnumb = "0" + _newnumb
  21.       ENDDO
  22.    ELSE                                         && Negative Number
  23.       _slength = ABS(_slength)
  24.       DO WHILE LEN(_newnumb) < _slength
  25.          _newnumb = _newnumb + "0"
  26.       ENDDO
  27.    ENDIF
  28.    RETURN(IF(("-"$_newnumb), "-"+STRTRAN(_newnumb, "-", ""), _newnumb))
  29.    
  30. * End of File
  31.  
  32.