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

I want to write a blog post building upon someone else's paper, how can I properly cite/credit them?

How does jetBlue determine its boarding order?

Convert a huge txt-file into a dataset

why it is 2>&1 and not 2>>&1 to append to a log file

Good introductory book to type theory?

A♭ major 9th chord in Bach is unexpectedly dissonant/jazzy

Concatenate all values of the same XML element using XPath/XQuery

Which "exotic salt" can lower water's freezing point by 70 °C?

Why did Gendry call himself Gendry Rivers?

Is it safe to keep the GPU on 100% utilization for a very long time?

Why can’t you see at the start of the Big Bang?

Antivirus for Ubuntu 18.04

Scaling rounded rectangles in Illustrator

Gift for mentor after his thesis defense?

Assuming a normal distribution: what is the sd for a given mean?

HTML folder located within IOS Image file?

GitLab account hacked and repo wiped

Translation of "invincible independence"

cd ` command meaning and how to exit it?

Why is there a cap on 401k contributions?

Test whether a string is in a list with variable

What is more safe for browsing the web: PC or smartphone?

While drilling into kitchen wall, hit a wire - any advice?

Is there an idiom that means that a clothe fits perfectly?



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













3















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


























    3















    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
























      3












      3








      3








      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 4 hours ago









      fuenfundachtzigfuenfundachtzig

      4,827123858




      4,827123858




















          2 Answers
          2






          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
            4 hours ago











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

            – egreg
            4 hours ago


















          0














          Like this?



          documentclassarticle

          makeatletter
          newcommand*IfStringInList[2]%
          in@,#1,,#2,%
          ifin@
          expandafter@firstoftwo
          else
          expandafter@secondoftwo
          fi

          makeatother

          begindocument
          newcommandwordPaul
          newcommandbutnotJoe
          edeftmpnoexpandIfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
          noexpandIfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it%
          tmp
          enddocument


          enter image description here






          share|improve this answer























            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

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            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
              4 hours ago











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

              – egreg
              4 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
              4 hours ago











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

              – egreg
              4 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 4 hours ago

























            answered 4 hours ago









            egregegreg

            739k8919393270




            739k8919393270












            • Oooh, e-type expansion!

              – Joseph Wright
              4 hours ago











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

              – egreg
              4 hours ago

















            • Oooh, e-type expansion!

              – Joseph Wright
              4 hours ago











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

              – egreg
              4 hours ago
















            Oooh, e-type expansion!

            – Joseph Wright
            4 hours ago





            Oooh, e-type expansion!

            – Joseph Wright
            4 hours ago













            @JosephWright I like to be modern. ;-)

            – egreg
            4 hours ago





            @JosephWright I like to be modern. ;-)

            – egreg
            4 hours ago











            0














            Like this?



            documentclassarticle

            makeatletter
            newcommand*IfStringInList[2]%
            in@,#1,,#2,%
            ifin@
            expandafter@firstoftwo
            else
            expandafter@secondoftwo
            fi

            makeatother

            begindocument
            newcommandwordPaul
            newcommandbutnotJoe
            edeftmpnoexpandIfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
            noexpandIfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it%
            tmp
            enddocument


            enter image description here






            share|improve this answer



























              0














              Like this?



              documentclassarticle

              makeatletter
              newcommand*IfStringInList[2]%
              in@,#1,,#2,%
              ifin@
              expandafter@firstoftwo
              else
              expandafter@secondoftwo
              fi

              makeatother

              begindocument
              newcommandwordPaul
              newcommandbutnotJoe
              edeftmpnoexpandIfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
              noexpandIfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it%
              tmp
              enddocument


              enter image description here






              share|improve this answer

























                0












                0








                0







                Like this?



                documentclassarticle

                makeatletter
                newcommand*IfStringInList[2]%
                in@,#1,,#2,%
                ifin@
                expandafter@firstoftwo
                else
                expandafter@secondoftwo
                fi

                makeatother

                begindocument
                newcommandwordPaul
                newcommandbutnotJoe
                edeftmpnoexpandIfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
                noexpandIfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it%
                tmp
                enddocument


                enter image description here






                share|improve this answer













                Like this?



                documentclassarticle

                makeatletter
                newcommand*IfStringInList[2]%
                in@,#1,,#2,%
                ifin@
                expandafter@firstoftwo
                else
                expandafter@secondoftwo
                fi

                makeatother

                begindocument
                newcommandwordPaul
                newcommandbutnotJoe
                edeftmpnoexpandIfStringInListwordGeorge,John,Paul,RingoBeat itRoll it
                noexpandIfStringInListbutnotGeorge,John,Paul,RingoBeat itRoll it%
                tmp
                enddocument


                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 1 hour ago









                marmotmarmot

                124k6161305




                124k6161305



























                    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

                    Log på Navigationsmenu

                    Creating second map without labels using QGIS?How to lock map labels for inset map in Print Composer?How to Force the Showing of Labels of a Vector File in QGISQGIS Valmiera, Labels only show for part of polygonsRemoving duplicate point labels in QGISLabeling every feature using QGIS?Show labels for point features outside map canvasAbbreviate Road Labels in QGIS only when requiredExporting map from composer in QGIS - text labels have moved in output?How to make sure labels in qgis turn up in layout map?Writing label expression with ArcMap and If then Statement?

                    Nuuk Indholdsfortegnelse Etyomologi | Historie | Geografi | Transport og infrastruktur | Politik og administration | Uddannelsesinstitutioner | Kultur | Venskabsbyer | Noter | Eksterne henvisninger | Se også | Navigationsmenuwww.sermersooq.gl64°10′N 51°45′V / 64.167°N 51.750°V / 64.167; -51.75064°10′N 51°45′V / 64.167°N 51.750°V / 64.167; -51.750DMI - KlimanormalerSalmonsen, s. 850Grønlands Naturinstitut undersøger rensdyr i Akia og Maniitsoq foråret 2008Grønlands NaturinstitutNy vej til Qinngorput indviet i dagAntallet af biler i Nuuk må begrænsesNy taxacentral mødt med demonstrationKøreplan. Rute 1, 2 og 3SnescootersporNuukNord er for storSkoler i Kommuneqarfik SermersooqAtuarfik Samuel KleinschmidtKangillinguit AtuarfiatNuussuup AtuarfiaNuuk Internationale FriskoleIlinniarfissuaq, Grønlands SeminariumLedelseÅrsberetning for 2008Kunst og arkitekturÅrsberetning for 2008Julie om naturenNuuk KunstmuseumSilamiutGrønlands Nationalmuseum og ArkivStatistisk ÅrbogGrønlands LandsbibliotekStore koncerter på stribeVandhund nummer 1.000.000Kommuneqarfik Sermersooq – MalikForsidenVenskabsbyerLyngby-Taarbæk i GrønlandArctic Business NetworkWinter Cities 2008 i NuukDagligt opdaterede satellitbilleder fra NuukområdetKommuneqarfik Sermersooqs hjemmesideTurist i NuukGrønlands Statistiks databankGrønlands Hjemmestyres valgresultaterrrWorldCat124325457671310-5