I want to split a space-delimited string into parts and generate code for each part. Apparently TeX works with comma-delimited strings natively so I tried writing an adaptation
\usepackage{xstring}
\makeatletter
\@for\next:=foo,bar,baz\do{X \next Y} \\
\StrSubstitute{foo bar baz}{ }{,} \\
\@for\next:=\StrSubstitute{foo bar baz}{ }{,}\do{X \next Y}
\makeatother
The first line of output for a comma-delimited string is correct. The second line of output showing a space-delimited-string being transformed into the corresponding comma-delimited string is correct.
However, in the third line, the second \@for
, the string isn't being split.
Why not and how do I fix this?
StrSubstitute
is not expandable – user31729 Jan 18 '17 at 13:02