I'm trying convert an argument to lowercase, strip out the spaces, and then search for the resulting string in a list. Thus far, I've had no luck.
Here's the code I would instinctively expect to work:
\newcommand{\mylist}{one,two,three}
\newcommand{\checkInList}[1]{
\StrDel{#1}{ }[\temp]
\IfSubStr{\mylist}{\lowercase{\temp}}
{yes}
{no}
}
\checkinlist{one}
I would expect that to print yes
, but it does not.
I've found numerous questions also dealing with this topic, but so far none of the solutions have worked for me. The closest I came to a solution was in \uppercase does not work with \IfSubStr?, but trying to alter that solution to my code just resulted in both yes
and no
being printed. I also made some slight progress with Pass a macro (with arguments) as an argument for another macro, but ultimately failed in the end there as well.
If there's a better way to strip spaces, force case, and check in a list of things, I am entirely open to something completely different. I have no real reason to stick with any of the commands I'm currently using over any others.
expl3
features?\lowercase
is not expandable. You should lowercase the string in advance, then do the search.expl3
to know why I'd be opposed, so I suppose not