Test whether a string is in a list with variablePackage to test whether a string is in a listTesting membership in a listTest whether token list is emptyUsing string variable with LaTeXString test, with complicated argumentsString test, with an OR connectorArbitrary string assigned to variable?use string variable as format string in begintabuHow to test whether pic text is empty in TiKZ?Select largest value from a list of variables in LaTeXPackage to test whether a string is in a listConditional to test whether in an itemize
Justification of physical currency in an interstellar civilization?
Scaling rounded rectangles in Illustrator
Can a player choose to add detail and flavor to their character's spells and abilities?
If an attacker targets a creature with the Sanctuary spell cast on them, but fails the Wisdom save, can they choose not to attack anyone else?
What did Varys actually mean?
Does it make sense to start saving into a 401k, if you might move out of the US before retirement?
How to increase speed on my hybrid bike with flat handlebars and 700X35C tyres?
Is there a reason why Turkey took the Balkan territories of the Ottoman Empire, instead of Greece or another of the Balkan states?
An adjective or a noun to describe a very small apartment / house etc
Why is the episode called "The Last of the Starks"?
Why were the rules for Proliferate changed?
In a series of books, what happens after the coming of age?
Why is the blank symbol not considered part of the input alphabet of a Turing machine?
call() a function within its own context
What's the difference between "ricochet" and "bounce"?
How do I minimise waste on a flight?
why it is 2>&1 and not 2>>&1 to append to a log file
Clauses with 3 infinitives at the end
shebang or not shebang
cd ` command meaning and how to exit it?
Is there any optimization for thread safety in for loop of Java?
How to make a kid's bike easier to pedal
Antivirus for Ubuntu 18.04
What's the role of the Receiver/Transmitter in Avengers Endgame?
Test whether a string is in a list with variable
Package to test whether a string is in a listTesting membership in a listTest whether token list is emptyUsing string variable with LaTeXString test, with complicated argumentsString test, with an OR connectorArbitrary string assigned to variable?use string variable as format string in begintabuHow to test whether pic text is empty in TiKZ?Select largest value from a list of variables in LaTeXPackage to test whether a string is in a listConditional to test whether in an itemize
Based on this question, I'd like the following
newcommandwordPaul
newcommandbutnotJoe
IfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
IfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it
to return Beat it and Roll it.
This has in principle been answered here but only with the help of 2 packages. It should, however, be possible much simpler with the solution here, only that I couldn't figure out how to expand the macro? (Not even with the help of this reference :/ )
conditionals expansion strings
add a comment |
Based on this question, I'd like the following
newcommandwordPaul
newcommandbutnotJoe
IfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
IfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it
to return Beat it and Roll it.
This has in principle been answered here but only with the help of 2 packages. It should, however, be possible much simpler with the solution here, only that I couldn't figure out how to expand the macro? (Not even with the help of this reference :/ )
conditionals expansion strings
add a comment |
Based on this question, I'd like the following
newcommandwordPaul
newcommandbutnotJoe
IfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
IfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it
to return Beat it and Roll it.
This has in principle been answered here but only with the help of 2 packages. It should, however, be possible much simpler with the solution here, only that I couldn't figure out how to expand the macro? (Not even with the help of this reference :/ )
conditionals expansion strings
Based on this question, I'd like the following
newcommandwordPaul
newcommandbutnotJoe
IfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
IfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it
to return Beat it and Roll it.
This has in principle been answered here but only with the help of 2 packages. It should, however, be possible much simpler with the solution here, only that I couldn't figure out how to expand the macro? (Not even with the help of this reference :/ )
conditionals expansion strings
conditionals expansion strings
asked 2 hours ago
fuenfundachtzigfuenfundachtzig
4,822123858
4,822123858
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Essentially a one liner with expl3:
documentclassarticle
usepackagexparse
ExplSyntaxOn
NewDocumentCommandIfStringInListmmmm
clist_if_in:neTF #2 #1 #3 #4
prg_generate_conditional_variant:Nnn clist_if_in:nn ne T,F,TF
ExplSyntaxOff
begindocument
newcommandwordPaul
newcommandbutnotJoe
IfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
IfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it
enddocument
With e we force full expansion of the first argument.

By the way, e expansion is a big achievement in TeX Live 2019, available with all TeX engines. Since you're talking of strings, I suppose that the material in the search string is fully expandable to characters.
Oooh,e-type expansion!
– Joseph Wright♦
2 hours ago
@JosephWright I like to be modern. ;-)
– egreg
2 hours ago
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f489502%2ftest-whether-a-string-is-in-a-list-with-variable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Essentially a one liner with expl3:
documentclassarticle
usepackagexparse
ExplSyntaxOn
NewDocumentCommandIfStringInListmmmm
clist_if_in:neTF #2 #1 #3 #4
prg_generate_conditional_variant:Nnn clist_if_in:nn ne T,F,TF
ExplSyntaxOff
begindocument
newcommandwordPaul
newcommandbutnotJoe
IfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
IfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it
enddocument
With e we force full expansion of the first argument.

By the way, e expansion is a big achievement in TeX Live 2019, available with all TeX engines. Since you're talking of strings, I suppose that the material in the search string is fully expandable to characters.
Oooh,e-type expansion!
– Joseph Wright♦
2 hours ago
@JosephWright I like to be modern. ;-)
– egreg
2 hours ago
add a comment |
Essentially a one liner with expl3:
documentclassarticle
usepackagexparse
ExplSyntaxOn
NewDocumentCommandIfStringInListmmmm
clist_if_in:neTF #2 #1 #3 #4
prg_generate_conditional_variant:Nnn clist_if_in:nn ne T,F,TF
ExplSyntaxOff
begindocument
newcommandwordPaul
newcommandbutnotJoe
IfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
IfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it
enddocument
With e we force full expansion of the first argument.

By the way, e expansion is a big achievement in TeX Live 2019, available with all TeX engines. Since you're talking of strings, I suppose that the material in the search string is fully expandable to characters.
Oooh,e-type expansion!
– Joseph Wright♦
2 hours ago
@JosephWright I like to be modern. ;-)
– egreg
2 hours ago
add a comment |
Essentially a one liner with expl3:
documentclassarticle
usepackagexparse
ExplSyntaxOn
NewDocumentCommandIfStringInListmmmm
clist_if_in:neTF #2 #1 #3 #4
prg_generate_conditional_variant:Nnn clist_if_in:nn ne T,F,TF
ExplSyntaxOff
begindocument
newcommandwordPaul
newcommandbutnotJoe
IfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
IfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it
enddocument
With e we force full expansion of the first argument.

By the way, e expansion is a big achievement in TeX Live 2019, available with all TeX engines. Since you're talking of strings, I suppose that the material in the search string is fully expandable to characters.
Essentially a one liner with expl3:
documentclassarticle
usepackagexparse
ExplSyntaxOn
NewDocumentCommandIfStringInListmmmm
clist_if_in:neTF #2 #1 #3 #4
prg_generate_conditional_variant:Nnn clist_if_in:nn ne T,F,TF
ExplSyntaxOff
begindocument
newcommandwordPaul
newcommandbutnotJoe
IfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
IfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it
enddocument
With e we force full expansion of the first argument.

By the way, e expansion is a big achievement in TeX Live 2019, available with all TeX engines. Since you're talking of strings, I suppose that the material in the search string is fully expandable to characters.
edited 2 hours ago
answered 2 hours ago
egregegreg
739k8919393270
739k8919393270
Oooh,e-type expansion!
– Joseph Wright♦
2 hours ago
@JosephWright I like to be modern. ;-)
– egreg
2 hours ago
add a comment |
Oooh,e-type expansion!
– Joseph Wright♦
2 hours ago
@JosephWright I like to be modern. ;-)
– egreg
2 hours ago
Oooh,
e-type expansion!– Joseph Wright♦
2 hours ago
Oooh,
e-type expansion!– Joseph Wright♦
2 hours ago
@JosephWright I like to be modern. ;-)
– egreg
2 hours ago
@JosephWright I like to be modern. ;-)
– egreg
2 hours ago
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f489502%2ftest-whether-a-string-is-in-a-list-with-variable%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown