[texhax] First character of a string

P.Taylor P.Taylor at Rhul.Ac.Uk
Mon May 9 20:12:32 CEST 2005

Simplistically, something like the following

     \def \firstofmany #1#2\sentinel {#1}
     \def \firstchar #1{\firstofmany #1\sentinel}

Of course, there are many caveats : TeX deals in
tokens, not characters; #1 must not contain \sentinel,
#1 must not be empty, and so on ...

Philip Taylor
Alex Torkhov wrote:

 > Hi all!
 > How can I make function in TeX that returns first character of its param?
 > Thanks,
 > Alex.
 > _______________________________________________
 > TeX FAQ: http://www.tex.ac.uk/faq
 > TeX newsgroup: http://groups.google.com/groups?group=comp.text.tex
 > Mailing list archives: http://tug.org/pipermail/texhax/
 > More links: http://tug.org/begin.html
 > Automated subscription management: http://tug.org/mailman/listinfo/texhax
 > Human mailing list managers: postmaster at tug.org

More information about the texhax mailing list