home *** CD-ROM | disk | FTP | other *** search
/ Software Du Jour / SoftwareDuJour.iso / BUSINESS / DBASE / CLIPUDF.ARC / FLOAT_$.PRG < prev    next >
Encoding:
Text File  |  1986-02-04  |  3.9 KB  |  109 lines

  1. EDITOR'S NOTE:
  2. Software designer Donald Yerxa of Autosoft, Inc (the makers of
  3. AutoMenu, a nifty DOS Interface shell) has sent us a UDF that
  4. returns a right-justified, floating dollar and comma output from
  5. a numeric input.
  6.  
  7. Included with this FUNCTION is the demo program DEMOFLOT.PRG for
  8. your entertainment. The FUNCTION, 'Fldlr' actually appears at the
  9. bottom of this file.
  10.  
  11. P.S. If you are interested in more information on AutoMenu contact
  12. Donald c/o Autosoft Inc., 860 Locust Street, Dubuque, Iowa 52001
  13. or call (319)556-7414
  14. -ROGER
  15.  
  16.  
  17. ********************************************************************
  18. *** Nantucket Clipper dBASE III Compiler User Defined            ***
  19. *** Function for output of amounts with floating dollar sign     ***
  20. *** and commas Demo program to illustrate use of the UDF         ***
  21. ***                                                              ***
  22. ********************************************************************
  23. *** Filename  : DEMOFLOT.PRG
  24. *** Programmer: D.C.Yerxa                                        ***
  25. ***             AutoSoft, Inc.                                   ***
  26. ***             860 Locust Street                                ***
  27. ***             Dubuque, Iowa 52001                              ***
  28. ***             (319)556-7414                                    ***
  29. ***                                                              ***
  30. *** Date: December 29, 1985                                      ***
  31. ********************************************************************
  32.  
  33. CLEAR
  34. TEXT
  35.  
  36.  
  37.                         CLIPPER - User Defined Function
  38.  
  39.                     Demonstration of Right Justified Ouput
  40.                                of an amount with
  41.                         floating dollar sign and commas
  42.  
  43.                                  Designed by:
  44.  
  45.                                Donald C. Yerxa
  46.                                 AutoSoft, Inc.
  47.                               860 Locust Street
  48.                              Dubuque, Iowa 52001
  49.                                 (319)556-7414
  50.  
  51. ENDTEXT
  52.  
  53. frame=CHR(201)+CHR(205)+CHR(187)+CHR(186)+CHR(188)+;
  54.       CHR(205)+CHR(200)+CHR(186)
  55. @ 1,13,21,64 BOX frame
  56. DO Flotdol
  57. amt=0
  58. @ 17,20 SAY 'Enter an amount: '
  59. CLEAR GETS
  60. @ 17,37 GET amt PICTURE '############.##'
  61. READ
  62. stramt=STR(AMT,16,2)
  63.  
  64. *** Example output to screen ***************
  65. temp=FLDLR(STRAMT)
  66. tmplen=LEN(TEMP)
  67. temp='Right Justified Output: '+temp
  68. @ 18,62-tmplen SAY REPLICATE('D',tmplen)
  69. @ 19,62-LEN(temp) SAY temp
  70. @ 20,62-tmplen SAY REPLICATE('M',tmplen)
  71. @ 23,27 SAY 'Press any key to quit: '
  72. SET CONSOLE OFF
  73.   WAIT
  74. SET CONSOLE ON
  75. CLEAR
  76. QUIT
  77.  
  78.  
  79. ********************************************************************
  80. *** Nantucket Clipper dBASE III Compiler - User Defined Function ***
  81. ***   for output of amounts with floating dollar sign and commas ***
  82. ***                                                              ***
  83. ********************************************************************
  84. *** Programmer: D.C.Yerxa                                        ***
  85. ***             AutoSoft, Inc.                                   ***
  86. ***             860 Locust Street                                ***
  87. ***             Dubuque, Iowa 52001                              ***
  88. ***             (319)556-7414                                    ***
  89. *** Date: December 29, 1985                                      ***
  90. ********************************************************************
  91.  
  92. FUNCTION Fldlr
  93. PARAM stramt
  94. DO WHILE SUBSTR(stramt,1,1)=' '.OR.SUBSTR(stramt,1,1)='0'
  95.   stramt=SUBSTR(stramt,2,LEN(stramt)-1)
  96. ENDDO
  97. IF INT(LEN(stramt)/3)=LEN(stramt)/3
  98.   nocom=(LEN(stramt)/3)-1
  99. ELSE
  100.   nocom=INT(LEN(stramt)/3)
  101. ENDIF
  102. FOR X=NOCOM TO 2 STEP -1
  103.   stramt=SUBSTR(stramt,1,LEN(stramt)-(X*3))+','+SUBSTR(stramt,LEN(stramt) ;
  104.     -(X*3)+1,X*3)
  105. NEXT
  106. stramt='$'+stramt
  107. RETURN(stramt)
  108. *** EOF FUNCTION Fldlr
  109.