I am adapting the LaTeX3 answer in this question: https://tex.stackexchange.com/a/61603
But I can't get the original MWE answer to compile using xelatex. I have renamed the variables, but the error is the same whether I use it verbatim (not counting the \str_case:nnn fix) or slightly adapted. So I am wondering if root syntax requirements have changed in the last couple of years since this question was answered?
\documentclass{article}
\usepackage{xparse}
\ExplSyntaxOn
\NewDocumentCommand{\BuildTablePortion}{ O{Default} m }{%
\my_BuildTablePortion:nn { #1 } { #2 }%
}
\cs_new:Npn \my_BuildTablePortion:nn #1 #2
{
\str_case:nnn { #2 }{%
{START} { Start data here}%
{END} { End Data here}%
% other possible strings
}%
{%
I~don't~know~what~to~do~with~`#1'%
}%
}%
\ExplSyntaxOff
\begin{document}
\BuildTablePortion{START}
\BuildTablePortion{END}
\end{document}
str_case:nnnand the solution of egreg has\prog_case:nnn– Oct 05 '15 at 17:05\str_case:nnnhas been renamed. If the third argument was code to be inserted when no match is found then the new name is\str_case:nnF– cgnieder Oct 05 '15 at 17:06\str_case:nnn, but that one escaped. You should have left a comment there, rather than asking a question. – egreg Oct 05 '15 at 17:11