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













2















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 :/ )










share|improve this question


























    2















    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 :/ )










    share|improve this question
























      2












      2








      2








      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 :/ )










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      fuenfundachtzigfuenfundachtzig

      4,822123858




      4,822123858




















          1 Answer
          1






          active

          oldest

          votes


















          3














          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.



          enter image description here



          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.






          share|improve this answer

























          • Oooh, e-type expansion!

            – Joseph Wright
            2 hours ago











          • @JosephWright I like to be modern. ;-)

            – egreg
            2 hours ago











          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
          );



          );













          draft saved

          draft discarded


















          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









          3














          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.



          enter image description here



          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.






          share|improve this answer

























          • Oooh, e-type expansion!

            – Joseph Wright
            2 hours ago











          • @JosephWright I like to be modern. ;-)

            – egreg
            2 hours ago















          3














          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.



          enter image description here



          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.






          share|improve this answer

























          • Oooh, e-type expansion!

            – Joseph Wright
            2 hours ago











          • @JosephWright I like to be modern. ;-)

            – egreg
            2 hours ago













          3












          3








          3







          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.



          enter image description here



          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.






          share|improve this answer















          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.



          enter image description here



          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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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

















          • 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

















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

          François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480