home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a013 / 1.ddi / SOURCE.EXE / F_PARSE.PRG < prev    next >
Encoding:
Text File  |  1991-01-25  |  762 b   |  31 lines

  1. *****************************************************************
  2. FUNCTION PARSE (string)
  3. *****************************************************************
  4.  
  5. * Extract a word delimited by spaces from a string.
  6.  
  7. * Copyright(c) 1991 - James Occhiogrosso
  8.  
  9. LOCAL space_char, ret_string
  10.  
  11. * Remove left spaces
  12. string = LTRIM(string)
  13.  
  14. * Get position of first blank character
  15. space_char = AT(' ', string)
  16.  
  17. IF space_char = 0
  18.     * No blanks, return balance of line and clear string
  19.     ret_string = string
  20.     string = ''
  21. ELSE
  22.     * Return all characters to next blank character.
  23.     ret_string = SUBSTR(string, 1, space_char - 1)
  24.     * Strip removed word from string
  25.     string = LTRIM(SUBSTR(string, space_char))
  26. ENDIF
  27.  
  28. RETURN ret_string
  29.  
  30.  
  31.