Here's a fairly general method to achieve your needs, based on expl3.
The input is split at a specified delimiter (and spaces around items are trimmed off); each item is “adorned” as specified by a template, in which the current item is denoted by #1; finally, the “adorned items” are output with a specified separator between them (any valid code).
Note that the template argument should have ##1 if \actonlist is used in the definition of another command.
\documentclass{article}
\ExplSyntaxOn
\NewDocumentCommand{\actonlist}{ m m +m m}
{% #1 = input separator
% #2 = template
% #3 = output separator
% #4 = list
\jinwen_actonlist:nnnn { #1 } { #2 } { #3 } { #4 }
}
\seq_new:N \l__jinwen_actonlist_in_seq
\seq_new:N \l__jinwen_actonlist_out_seq
\cs_new_protected:Nn \jinwen_actonlist:nnnn
{
\seq_set_split:Nnn \l__jinwen_actonlist_in_seq { #1 } { #4 }
\seq_set_map:NNn \l__jinwen_actonlist_out_seq \l__jinwen_actonlist_in_seq { #2 }
\seq_use:Nn \l__jinwen_actonlist_out_seq { #3 }
}
\ExplSyntaxOff
\begin{document}
\actonlist{\}{\emph{#1}}{ (here a par)\par}{A\B\C}
\newcommand{\test}[1]{%
\actonlist
{\}
{\emph{##1}}
{ (here a par)\par}
{#1}%
}
\test{A\B\C}
\newcommand{\testcomma}[1]{%
\actonlist
{,}
{\textbf{##1}}
{ (here a par)\par}
{#1}%
}
\testcomma{A, B, C}
\end{document}
You can see from “here a par” that the output separator is only used between items. If you also need to use it at the end, just add to it in the definition of \test, say
\newcommand{\test}[1]{%
\actonlist
{\\}
{\emph{##1}}
{ (here a par)\par}
{#1} (here a par)\par
}

A\\B\\Cinto\action{A}\action{B}\action{C}, not\action{A}\\\action{B}\\\action{C}. – Jinwen Feb 03 '21 at 10:29\afterfi, it seems to need 2 parameters, but only{\testA#2\\}is passed to it, what's going on? – Jinwen Feb 03 '21 at 11:08\afterfiis my macro, I am using it in the context\if.. do-something\afterfi{xx}\else do-something-else\afterfi{yy}\fi. The\elsepart is completely ignored by\afterfi{xx}in this case. LateX uses different approach\firstoftwo,\secondoftwo, but I have only single macro. – wipet Feb 03 '21 at 11:21\test, do you think the problem there has to do with the definition of this macro? – Jinwen Feb 03 '21 at 12:11