Consider the following document:
\documentclass{article}
\usepackage{xstring}
\makeatletter
\newcommand{\mycommand@firstchar}[1]{%
\StrRemoveBraces{#1}[\FirstChar]%
\StrChar{\FirstChar}{1}[\FirstChar]%
\FirstChar%
}
\newcommand{\mycommand@removespaces}[1]{\zap@space#1 \@empty}
\newcommand{\mycommand@lowercase}[1]{\expandafter\MakeLowercase\expandafter{#1}}
\newcommand{\makecode}[3]{\mycommand@removespaces{\mycommand@lowercase{%
\mycommand@firstchar{#1}\StrRemoveBraces{#2}:\StrRemoveBraces{#3}%
}}}
\makeatother
\begin{document}
\makecode{First}{Second}{Third}
%should produce fsecond:third
\end{document}
What I am trying to do is to write a command that takes 3 arguments, keep the letter of the first one, combine it with the second one, adds a colon separator and adds the third parameter, while removing all the spaces and braces and making the whole thing lower case.
However the current code shown above fails to compile, and I don't understand why, and how to solve the problem.
\MakeLowercase
doesn't return the lowercased argument, but the set of instructions to print the argument lowercase.