home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / rexx / api / callrexx / backward.fnc next >
Text File  |  1999-05-11  |  1KB  |  20 lines

  1. /*********************************************************************/
  2. /* BACKWARD.FNC - Reverse the words in a string                      */
  3. /*                                                                   */
  4. /* This program is called by CALLREXX.EXE.                           */
  5. /*                                                                   */
  6. /* Input:  A string of words                                         */
  7. /*                                                                   */
  8. /* Output: A string containing the same words but in opposite order  */
  9. /*                                                                   */
  10. /*********************************************************************/
  11. Parse Arg Data                         /* get argument string        */
  12. OutString = ''                         /* initialize output to empty */
  13. Count = Words(Data)                    /* find number of words       */
  14. Do i = Count To 1 By -1                /* for each word in string    */
  15.    OutString = OutString Word(Data,i)  /*   add word to output string*/
  16.    End /* end do */
  17. Return Strip(OutString)                /* return reversed string,    */
  18.                                        /* removing any blanks on the */
  19.                                        /* front or back.             */
  20.