I try to use a "Switch Case" macro in my LaTex File. But I want to put in the "Switch Case" macro the month not a number. Unfortunately a get nada as output instead of 31.01.22.
Source:Implementing switch cases
\documentclass{article}
\usepackage{pdftexcmds}
\makeatletter
\newcommand*{\dothis}[1]{%
\stringcases
{#1}%
{%
{1}{31.01.\the\year}
{2}{28.02.\the\year}
{3}{31.03.\the\year}
{4}{30.04.\the\year}
{5}{31.05.\the\year}
{6}{30.06.\the\year}
{7}{31.07.\the\year}
{8}{31.08.\the\year}
{9}{30.09.\the\year}
{10}{31.10.\the\year}
{11}{30.11.\the\year}
{12}{31.12.\the\year}
}%
{[nada]}%
}
\newcommand{\stringcases}[3]{%
\romannumeral
\str@case{#1}#2{#1}{#3}\q@stop
}
\newcommand{\str@case}[3]{%
\ifnum\pdf@strcmp{\unexpanded{#1}}{\unexpanded{#2}}=\z@
\expandafter\@firstoftwo
\else
\expandafter\@secondoftwo
\fi
{\str@case@end{#3}}
{\str@case{#1}}%
}
\newcommand{\str@case@end}{}
\long\def\str@case@end#1#2\q@stop{\z@#1}
\makeatother
\begin{document}
\dothis{\the\month}
\dothis{2}
\dothis{3}
\dothis{4}
\end{document}




