I have an input string like "123-45" or "1-3-5" or "2-4; 6-8" where the minus signed should be removed. This is easy with the xstring
package.
\StrSubstitute{#1}{-}{}
The next step is to split the input strings at the semicolon. This maybe could be done with \StrMid
. The final output should be than:
123-45 = \somecommand{12345}
1-3-5 = \somecommand{135}
2-4 = \somecommand{24}
6-8 = \somecommand{68}
At the moment I have this not real working code:
\newcommand{\test}[1]{%
\newcommand{\stripped}{\StrSubstitute{#1}{-}{}}%
\IfInteger{\stripped}{\somecommand{\stripped}}{error}%
}
How can I solve this issue?
Best Answer
You can also use the
xstring
package: