# xparse SplitList parameter expansion

I need to split comma-separed string from variable (actually data file) for further procesing.

There is MWE:

\documentclass{article}
\usepackage{csvsimple}
\usepackage{xparse}
\usepackage{filecontents}

\begin{filecontents*}{sample.csv}
colA;
A,B,C;
\end{filecontents*}

\NewDocumentCommand{\myfunc}{ >{\SplitList{,}} m }{\ProcessList{#1}{\func}}
\NewDocumentCommand{\func}{m}{\fbox{#1}}

\newcommand{\textA}{a,b,c}

\begin{document}
\parindent=0pt

(1) \myfunc{a,b,c}\\  % OK
(2) \myfunc{\textA}\\ % Wrong
(3) \expandafter\myfunc\expandafter{\textA}\\ % OK

separator=semicolon
]{sample.csv}{}%
{
(4) \expandafter\myfunc\expandafter{\colA} % Wrong (how to correct?)
}
\end{document}


What is the correct way to expand argument in case (4) in the same way as (1) or (3)??

Thank you very much in advance for any help or suggestion!

Best regards,

Lubos

This has not much to do with xparse, rather with the fact that \csvreader sets \colA to a macro containing what you're after, so it needs to be expanded twice. One way is to do
\expandafter\expandafter\expandafter\myfunc

instead of only two \expandafter.
• I would probably use expl3: for instance (between \ExplSyntaxOn and \ExplSyntaxOff) one could do (4) ~ \exp_args:Nf \myfunc { \colA } to fully expand \colA on the left. (Note I used ~ for the space after (4).) – Bruno Le Floch Aug 9 '16 at 18:05