[comp.text.tex] Grabbing substrings?

barrett@jhunix.HCF.JHU.EDU (Dan Barrett) (05/29/91)

	I want to write a LaTeX or TeX macro that expands to a substring
of its argument.  For example, a macro \basename{} would take a UNIX
filename as an argument:

		\basename{/usr/local/bin/foobar}

and expand to:

		foobar

Can TeX/LaTeX isolate substrings in a macro argument?  The rule I want to
embody is:

		"If the argument has a '/' character, then expand to
		the string immediately following the last '/'.
		Otherwise, expand to the entire argument."

Please respond by e-mail only  -- thanks!

                                                        Dan

 //////////////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
| Dan Barrett, Department of Computer Science      Johns Hopkins University |
| INTERNET:   barrett@cs.jhu.edu           |                                |
| COMPUSERVE: >internet:barrett@cs.jhu.edu | UUCP:   barrett@jhunix.UUCP    |
 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/////////////////////////////////////