Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!lll-winken!unixhub!linac!midway!zem!jeff From: jeff@zem.uchicago.edu (Jeff Adler) Newsgroups: comp.text.tex Subject: Want to extract words from a string Message-ID: <1991Jan30.214041.11089@midway.uchicago.edu> Date: 30 Jan 91 21:40:41 GMT Sender: news@midway.uchicago.edu (News Administrator) Organization: Department of Mathematics, University of Chicago Lines: 22 Suppose I have a string consisting of words separated by blanks. I would like a macro which returns the last word of the string, and another macro which returns everything else. Example: \lastword{one two three four} yields four \butlastword{one two three four} yields one two three Also, if it isn't too complicated, it would be nice if these macros ignored blanks inside nested braces. Example: \lastword{one two three four\footnote{five six}} yields four\footnote{five six} I'd appreciate any help anyone out there can give. Please respond by e-mail, and I'll summarize. --------------------------------------------------------------------------- Jeff Adler jeff@zaphod.uchicago.edu Math Department jeff%zaphod@midway.uchicago.edu University of Chicago jda3@midway.uchicago.edu