Re: Sorting Filenames into HTML Coding
- To: mathgroup at smc.vnet.net
- Subject: [mg108703] Re: Sorting Filenames into HTML Coding
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Sun, 28 Mar 2010 04:07:48 -0500 (EST)
- References: <ho76tp$ru$1@smc.vnet.net>
BenT wrote: > I have a web page HTML coding problem which I'm trying to use Mathematica's > file and string functions to solve for me. > > I've created a text file, in DOS of 695 file names which I've > "imported" (via the "Lines" option) and need to manipulate each into > HTML table data code like the following: > > For example, given a file name of "Aaron Robarts Wolfe.pdf", I then > need to (while processing each filename such as with the For[] > function, loaded already into a 695 element array, convert it to the > following HTML code: > > <tr><td><a href="Portraits Aaron Robarts Wolfe.pdf">Wolfe, Aaron > Robarts</td></tr> > > The output coding of the names however must be sorted as if they were > in a Last, First Middle (if any) order which I'll cut/paste into the > "master" HTML documents for the web page concerned. > > It would be very nice to include "letter" separators into the coding > (as opposed to me having to cut/paste each letter category into the > master docuement, The coding for each letter should be like this: > > <tr><th><a name="A"></a>A</th></tr> > > The "name" tags have already been defined in the master document. > > Any help would be greatly appreciated! > I think you need to be more specific as to what you need help with. I mean, given a file full of file names (BTW, I assume that you mean a text file, rather than a DOS file), it is easy to read that as strings with ReadList. It is also easy to use StringJoin (<>) to prepare lines of HTML, etc. So tell us exactly what it is that you can't do - preferably with some of your code, and someone will surely help. David Bailey http://www.dbaileyconsultancy.co.uk