# [texhax] Taking apart text of macro argument

Peter Seibel peter at gigamonkeys.com
Thu May 28 01:13:16 CEST 2009

Suppose I have a macro that takes one argument:

\def\foo#1{...}

but within the expansion I want to pull off the first character (so I
can uppercase it) and the rest of the text (so I can lowercase it).

I.e. I want to be able to say:

\foo{Some thing With Mixed Case}

and have it turn into:

Some thing with mixed case

Is there any way to do that in either Plain TeX or LaTeX? (I actually
need this case manipulation so if there's an easy way to do that,
cool. I'd also be interested in the more general question of how to
take apart the text of the argument.)

-Peter

I realize I could do something like:

\def\foo#1#2\par

but then I can't say \foo{...}

--
Peter Seibel
http://www.codersatwork.com/
http://www.gigamonkeys.com/blog/