Monday, November 08, 2010 at 12:00 AM.
system.verbs.apps.AnArchie.examples.urlToFTPRec
on urlToFTPRec (urlString) { local (tmp, theHost, thePath, name, ftpRec); << just in case, get rid of the <> that may surround the string urlString = string.popLeading(urlString, "<"); urlString = string.popTrailing(urlString, ">"); << first strip the ftp/file prefix tmp = string.nthField(urlString, ":", 1); urlString = string.delete(urlString, 1, sizeof(tmp)+3); << string + : + // << now find the host theHost = string.nthfield(urlString, "/", 1); << and finally the path and name thePath = string.delete(urlString, 1, sizeof(theHost)); name = string.nthField(thePath, "/", string.countFields(thePath, "/")); thePath = thePath - name; << and remove it the easy way! << and finally fill out the ftpRec with anarchie, eventInfo { ftpRec = {'name': name, path: thePath, host: theHost}}; return(ftpRec); } <<urlToFTPRec("ftp://ftp.brown.edu/pub/tcl/classes/TurboTCP-1.0b6-C-classes")
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.