home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / FLOAT_DS.ZIP / FLOAT_DS.UDF
Encoding:
Text File  |  1988-07-30  |  1.0 KB  |  40 lines

  1. * ────────────────────────────────────────────
  2. * format numerics with floating $ sign and
  3. * rejustifies to the right if requested
  4. * ────────────────────────────────────────────
  5. * syntax: Float_Ds(Nvar,Nlen,Rjst)
  6. *         Nvar: numeric value of field
  7. *         Nlen: length of field
  8. *         Rjst: .T. for right just
  9. *
  10. * returns: Fvar
  11.  
  12. Function Float_Ds
  13. Parameters Nvar,Nlen,Rjst
  14.  
  15. Private cvar,;                         && character conversion of number
  16.         clen,;                         && length of converted field
  17.         fvar                           && formatted output
  18.  
  19.   * currently set to allow for up to 11 positions (99999999.99)
  20.   cvar = str(nvar,11,2)
  21.  
  22.   * increment by 1 to account for $
  23.   nlen = nlen + 1
  24.  
  25.   * left trim and attach $
  26.   fvar = '$' + ltrim(cvar)
  27.  
  28.   If Rjst
  29.       * pad back out w/blanks to original size of field
  30.       clen = len(fvar)
  31.  
  32.       * get # of positions to pad for right just
  33.       padd = nlen - clen
  34.       fvar = space(padd) + fvar
  35.   Endif
  36.  
  37. Return(fvar)
  38.  
  39. * Eofunc - Float_Ds
  40.