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

Creating rule-based sublists

$
0
0

I have a list each element of which consists of a list containing two strings and two integers:

lis = {{"ab", 2, "c", 3}, {"d", 3, "e", 4}, {"ac", 5, "f", 6}, {"c", 7, "d", 8}, {"ad", 9, "c", 10}}

I would like to create a new list that includes every member of lis whose first element starts with "a":

res = {{"ab", 2, "c", 3}, {"ac", 5, "f", 6}, {"ad", 9, "c", 10}}

This would seem to be a simple task for StringCases, but I am not having much luck; suggestions would be gratefully received.


Viewing all articles
Browse latest Browse all 190

Latest Images

Trending Articles



Latest Images

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