The xstring
package carries out an \edef
(exhaustive expansion) on its argument. Stefan has suggested one approach, but depending on what you want to achieve an alternative is to create an expandable version of the upper case command. There is one built-in to expl3
, which needs renaming for use in a document:
\documentclass{article}
\usepackage{xstring,expl3}
\ExplSyntaxOn
\cs_gset_eq:NN \MakeExpandableUppercase \text_uppercase:n
\ExplSyntaxOff
\begin{document}
\newcommand{\cim}{c1095}
\StrMid{\MakeExpandableUppercase{\cim}}{1}{1}\space or
\StrMid{\expandafter\MakeExpandableUppercase\expandafter{\cim}}{1}{1} ?
\StrMid{\cim}{2}{100}
\end{document}
As I've indicated, I'm not sure what order you want the case change to happen in, relative to the string extraction.
\MakeUppercase{\noexpand\StrMid{\cim}{1}{1}}
? Not sure the\noexpand
is needed, and I can't test on this computer.