I created a custom command to be used for printing sizes. For easier checking the commands options I use a custom 'switch' environment.
Sadly there is always a space before and after the inserted sizes and I cannot find a way to get rid of them.
Where's my mistake?
\documentclass{scrartcl}
\usepackage{xifthen}
\newenvironment{switch}[1]{%
\newboolean{default}
\setboolean{default}{true}
%
\newcommand{\case}{}
\renewcommand{\case}[2]{\ifthenelse{\equal{#1}{##1}}{%
\setboolean{default}{false}##2}{}}%
%
\newcommand{\default}{}
\renewcommand{\default}[1]{\ifthenelse{\boolean{default}}{##1}{}}
}{}
\newcommand{\sizesDWLmm}[4][]{%
\begin{switch}{#1}%
\case{short}{(DWL~#2~$\times$~#3~$\times$~#4mm)} %
\case{long}{(depth~#2mm~$\times$ width~#3mm~$\times$ length~#4mm)} %
\default{(#2~$\times$~#3~$\times$~#4mm)} %
\end{switch}
}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas at blandit libero. Curabitur luctus pulvinar \sizesDWLmm{4}{5}{9} mauris ac accumsan. Nulla sollicitudin ex \sizesDWLmm[long]{4}{5}{9} ac pellentesque accumsan. Interdum et malesuada fames ac ante ipsum primis in faucibus. Donec vel venenatis nunc. In ac vulputate nunc. Aliquam \sizesDWLmm[short]{4}{5}{9} volutpat ultricies consectetur. Nullam quis orci id nisi facilisis dapibus vel ut risus.
\end{document}
This is how this MWE looks:

%other wise the line break at the end of the line is converted into a space – daleif Mar 23 '20 at 14:03%) at the end of lines? – Werner Mar 23 '20 at 16:41