I have several functions defined by similar way, and they will be used later by the name base + argument.
I do not find \cs_use:c
, but there is \use:c
and \cs_if_exist_use:c
. Is this the correct way to do such thing or I should use something else like \str_case:nn
?
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\cs_new_protected:Nn \my_test_a:n
{
*#1*
}
\cs_new_protected:Nn \my_test_b:n
{
+#1+
}
\NewDocumentCommand { \test } { m m }
{
\cs_if_exist_use:c { my_test_#1:n } { #2 }
}
\ExplSyntaxOff
\begin{document}
\test{a}{abc}
\test{b}{abc}
\end{document}
\cs_if_exist:cTF
, which might help.