Quantcast
Channel: Active questions tagged string-manipulation - Mathematica Stack Exchange
Viewing all articles
Browse latest Browse all 195

Deleting certain integers from string list

$
0
0

I have a list of strings:

lis = {"a","1","b","2","c","3","a","d","4"}

and would like to get:

res = {"a","b","2","c","3","a","d","4"}

where each occurrence of "a" that is immediately followed by (a string representation of) an integer, that integer is deleted from the list. ToExpression followed by IntegerQ seems inefficient, would be grateful for thoughts.


Viewing all articles
Browse latest Browse all 195

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>