xstring package provides some functions for string operation, \IfStrEqCase can be used for this purpose. Using pdfTeX (latex command is often pdfTeX), you can also use \pdfstrcmp for comparation. This does not work as \@ifnextchar, but may be helpful.
\documentclass{article}
\usepackage{xstring}
\begin{document}
\newcommand\test[1]{%
\IfStrEqCase{#1}{%
{a}{I got `a'}
{bb}{I got `bb'}
{ccc}{I got `ccc'}}%
[I got unknown string]\par}
\test{a} % I got `a'
\test{bb} % I got `bb'
\test{ccc} % I got `ccc'
\test{other} % I got unknown string
\end{document}
Besides, it is difficult to generalize \@ifnextchar for alphabets. TeX cannot distinguish \foo + ab from a single command \fooab.
You can define several commands begin with \foo, but each one should ends with alphabets.
\documentclass{article}
\begin{document}
\makeatletter
\def\strlist{a,bb,ccc}
\@for\curstr:=\strlist\do{%
\long\expandafter\edef \csname test\curstr\endcsname
{I got `\curstr'.\par}%
}
\makeatother
\testa % I got `a'
\testbb % I got `bb'
\testccc % I got `ccc'
\end{document}
Using etextools, you can partially generalize \@ifnextchar to multiple charcter (non-alphabets or alphabets are allowed). This is the closest one.
\documentclass{article}
\usepackage{etextools}
\usepackage{xstring}
\begin{document}
\def\test{%
\futuredef[-+ab]\nexttokens{%
\IfStrEqCase{\nexttokens}{%
{-}{I got `-'}
{-+}{I got `-+'}
{+ab}{I got `+ab'}}%
[I got unknown string]\par}}
\test- % I got `-'
\test-+ % I got `-+'
\test+ab % I got `+ab'
\test++ab % I got unknown string
\test a % I got unknown string
\end{document}
\@ifnextcharsgot already implemented, I think even twice, but I can't recall where right now. Was itbeamer,pgf/tikzor koma script? – Martin Scharrer Feb 07 '11 at 20:23