home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 20.4 PARSE()
- Author: Joe Booth
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- //───── NOTE: must compile with the /N option!
-
- function PARSE( pstring,pdelim )
- STATIC def_delim := "," // default delimiter
- LOCAL rlist :={},k
- pdelim := if(pdelim==NIL, def_delim, pdelim)
- while len(pstring) > 0
- if (k := at(pdelim,pstring) ) > 0
- Aadd(rlist,left(pstring,k-1))
- pstring := substr(pstring,k+1)
- else
- Aadd(rlist,pstring)
- pstring :=""
- endif
- enddo
- return rlist
-
- // end of file CHP2004.PRG
-