I've been trying to give some formatted input to \StrCut from the xstring package in a very complex code, and I've been getting an error.
Here is a MWE :
\documentclass[a4paper]{article}
\usepackage{xstring}
\begin{document}
\newcommand{\test}{\emph{First} part:Second part}
\StrCut{\test}{:}\firstpart\secondpart%
\firstpart --- \secondpart%
\end{document}
I get this error :
! Use of \@xs@StrCut@@ doesn't match its definition.
\text@command #1->\def \reserved@a {
#1}\ifx \reserved@a \@empty \let \check@...
l.7 \StrCut{\test}{:}
\firstpart\secondpart%
Any tip ?
EDIT :
With this MWE :
\documentclass[a4paper]{article}
\usepackage{xstring}
\begin{document}
\newcommand{\test}{\emph{First} part:Second part}
\newcommand{\testbis}{\test}
\expandarg\StrCut{\testbis}{:}\firstpart\secondpart%
\firstpart --- \secondpart%
\end{document}
I don't get any error, but the output is not what I expect, since \test isn't cut.

\expandarg\StrCutetc. – Nov 24 '15 at 17:27\edefisexpanded definitionwhich will work until used in\StrCut. See my update please. I usedexpl3syntax for it, but that doesn't matter – Nov 24 '15 at 21:37\expandargdoes just one expansion step; with\testbisyou're adding a layer of expansion and of course the splitting will not happen. – egreg Nov 24 '15 at 22:22