Change nested list of symbols to nested list of numbers
Clash 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!
list-manipulation symbols
add a comment |Â
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!
list-manipulation symbols
add a comment |Â
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!
list-manipulation symbols
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
list-manipulation symbols
asked 18 mins ago
Daniel Wilson-Nunn
1705
1705
add a comment |Â
add a comment |Â
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
Here's an alternative forMap
:Function[sym, ..., Listable]
.
â Kubaâ¦
2 mins ago
add a comment |Â
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
Here's an alternative forMap
:Function[sym, ..., Listable]
.
â Kubaâ¦
2 mins ago
add a comment |Â
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
Here's an alternative forMap
:Function[sym, ..., Listable]
.
â Kubaâ¦
2 mins ago
add a comment |Â
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
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
answered 9 mins ago
kglr
162k8187386
162k8187386
Here's an alternative forMap
:Function[sym, ..., Listable]
.
â Kubaâ¦
2 mins ago
add a comment |Â
Here's an alternative forMap
: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
add a comment |Â
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
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
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
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
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