Change nested list of symbols to nested list of numbers

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
5
down vote

favorite












I have some nested lists of symbols, all of the same format, and I wish to convert them to nested lists of integers, i.e.



e1,e1,e1,e2 -> 1,1,1,2


Any quick ways to do this?



Note: I will always have nested lists of that form, but their length may vary and the symbols may not always have single digit integers in them, e.g.



e4,e200,e1,e11,e23 -> 4,200,1,11,23


Many thanks!










share|improve this question

























    up vote
    5
    down vote

    favorite












    I have some nested lists of symbols, all of the same format, and I wish to convert them to nested lists of integers, i.e.



    e1,e1,e1,e2 -> 1,1,1,2


    Any quick ways to do this?



    Note: I will always have nested lists of that form, but their length may vary and the symbols may not always have single digit integers in them, e.g.



    e4,e200,e1,e11,e23 -> 4,200,1,11,23


    Many thanks!










    share|improve this question























      up vote
      5
      down vote

      favorite









      up vote
      5
      down vote

      favorite











      I have some nested lists of symbols, all of the same format, and I wish to convert them to nested lists of integers, i.e.



      e1,e1,e1,e2 -> 1,1,1,2


      Any quick ways to do this?



      Note: I will always have nested lists of that form, but their length may vary and the symbols may not always have single digit integers in them, e.g.



      e4,e200,e1,e11,e23 -> 4,200,1,11,23


      Many thanks!










      share|improve this question













      I have some nested lists of symbols, all of the same format, and I wish to convert them to nested lists of integers, i.e.



      e1,e1,e1,e2 -> 1,1,1,2


      Any quick ways to do this?



      Note: I will always have nested lists of that form, but their length may vary and the symbols may not always have single digit integers in them, e.g.



      e4,e200,e1,e11,e23 -> 4,200,1,11,23


      Many thanks!







      list-manipulation symbols






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 18 mins ago









      Daniel Wilson-Nunn

      1705




      1705




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          5
          down vote













          symbols = e4, e200, e1, e11, e23;
          Map[FromDigits@StringDrop[SymbolName[#], 1] &, symbols, -1]



          4, 200, 1, 11, 23




          Map[FromDigits @ StringCases[SymbolName[#], NumberString] &, symbols, -1]



          4, 200, 1, 11, 23






          share




















          • Here's an alternative for Map: Function[sym, ..., Listable].
            – Kuba♦
            2 mins ago










          Your Answer




          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "387"
          ;
          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',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182823%2fchange-nested-list-of-symbols-to-nested-list-of-numbers%23new-answer', 'question_page');

          );

          Post as a guest






























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          5
          down vote













          symbols = e4, e200, e1, e11, e23;
          Map[FromDigits@StringDrop[SymbolName[#], 1] &, symbols, -1]



          4, 200, 1, 11, 23




          Map[FromDigits @ StringCases[SymbolName[#], NumberString] &, symbols, -1]



          4, 200, 1, 11, 23






          share




















          • Here's an alternative for Map: Function[sym, ..., Listable].
            – Kuba♦
            2 mins ago














          up vote
          5
          down vote













          symbols = e4, e200, e1, e11, e23;
          Map[FromDigits@StringDrop[SymbolName[#], 1] &, symbols, -1]



          4, 200, 1, 11, 23




          Map[FromDigits @ StringCases[SymbolName[#], NumberString] &, symbols, -1]



          4, 200, 1, 11, 23






          share




















          • Here's an alternative for Map: Function[sym, ..., Listable].
            – Kuba♦
            2 mins ago












          up vote
          5
          down vote










          up vote
          5
          down vote









          symbols = e4, e200, e1, e11, e23;
          Map[FromDigits@StringDrop[SymbolName[#], 1] &, symbols, -1]



          4, 200, 1, 11, 23




          Map[FromDigits @ StringCases[SymbolName[#], NumberString] &, symbols, -1]



          4, 200, 1, 11, 23






          share












          symbols = e4, e200, e1, e11, e23;
          Map[FromDigits@StringDrop[SymbolName[#], 1] &, symbols, -1]



          4, 200, 1, 11, 23




          Map[FromDigits @ StringCases[SymbolName[#], NumberString] &, symbols, -1]



          4, 200, 1, 11, 23







          share











          share


          share










          answered 9 mins ago









          kglr

          162k8187386




          162k8187386











          • Here's an alternative for Map: Function[sym, ..., Listable].
            – Kuba♦
            2 mins ago
















          • Here's an alternative for Map: Function[sym, ..., Listable].
            – Kuba♦
            2 mins ago















          Here's an alternative for Map: Function[sym, ..., Listable].
          – Kuba♦
          2 mins ago




          Here's an alternative for Map: Function[sym, ..., Listable].
          – Kuba♦
          2 mins ago

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f182823%2fchange-nested-list-of-symbols-to-nested-list-of-numbers%23new-answer', 'question_page');

          );

          Post as a guest













































































          Comments

          Popular posts from this blog

          What does second last employer means? [closed]

          Installing NextGIS Connect into QGIS 3?

          One-line joke