I'm inserting graphics from data in a csv-file and due to lazy input I have to get rid of leading and trailing spaces. It works fine with the trimspaces package.
\documentclass{article}
\usepackage{expl3,graphicx}
\usepackage{trimspaces}
\begin{document}
\def\testA{example-image-a }
%\includegraphics{\testA} %error
\def\testB{ example-image-a}
%\includegraphics{\testB} %error
\makeatletter
\trim@spaces@in\testA
\includegraphics{\testA}
\trim@spaces@in\testB
\includegraphics{\testB}
\end{document}
By curiosity I tried to get this with expl3 and \tl_trim_spaces:n but didn't find a sensible way to store the content of the commands without the spaces in a command. Does someone know how to do it?
