home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / orx8.zip / routine_pp_number.cmd < prev    next >
OS/2 REXX Batch file  |  1997-07-21  |  3KB  |  62 lines

  1. /******************************************************************************/
  2. /*
  3. program:   routine_pp_number.cmd
  4. type:      Object REXX, REXXSAA 6.0
  5. purpose:   filters a string to contain English alphanumeric chars only; embedded non-alphanum chars are
  6.            translated into an underscore ("_")
  7. version:   1.0
  8. date:      1997-04-15
  9. changed:   ---
  10.  
  11. author:    Rony G. Flatscher
  12.            Rony.Flatscher@wu-wien.ac.at
  13.            (Wirtschaftsuniversitaet Wien, University of Economics and Business
  14.            Administration, Vienna/Austria/Europe)
  15. needs:     ---
  16.  
  17. usage:     call or require & see code, resp. comments
  18.            (also, you might copy & paste the code to the desired module, given its size)
  19.  
  20. comments:  prepared for the "8th International Rexx Symposium 1997", April 1997, Heidelberg/Germany
  21.  
  22.  
  23. All rights reserved and copyrighted 1995-1997 by the author, no guarantee that
  24. it works without errors, etc.  etc.
  25.  
  26. You are granted the right to use this module under the condition that you don't charge money for this module (as you didn't write
  27. it in the first place) or modules directly derived from this module, that you document the original author (to give appropriate
  28. credit) with the original name of the module and that you make the unaltered, original source-code of this module available on
  29. demand.  If that holds, you may even bundle this module (either in source or compiled form) with commercial software.
  30.  
  31. If you find an error, please send me the description (preferably a *very* short example);
  32. I'll try to fix it and re-release it to the net.
  33. */
  34.  
  35. /*                                                                            */
  36. /* name:    pp_number( number )                                               */
  37. /*                                                                            */
  38. /* purpose: pretty-print number (US-style)                                    */
  39. /*                                                                            */
  40. /* returns: formatted number                                                  */
  41. /*                                                                            */
  42. /* remarks: copied from DrDialog sample "DRIVE.RES"                           */
  43. /*                                                                            */
  44. /* created: rgf, 95-10-21                                                     */
  45.  
  46. :: ROUTINE PP_Number                    PUBLIC
  47.    PARSE ARG number
  48.  
  49.  
  50.    PARSE VAR number number "." fraction
  51.  
  52.    tmpResult = ''
  53.    DO WHILE length( number ) > 3
  54.       tmpResult = ',' || RIGHT( number, 3 ) || tmpResult
  55.       number = LEFT( number, LENGTH( number ) - 3 )
  56.    END
  57.  
  58.    IF fraction <> "" THEN tmpResult = tmpResult || "." || fraction
  59.  
  60.    RETURN number || tmpResult
  61. /******************************************************************************/
  62.