Quantcast
Viewing all articles
Browse latest Browse all 186

Deleting certain integers from string list

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 186

Trending Articles