Skip to main content
Tweeted twitter.com/StackMma/status/1169988738035912706
Became Hot Network Question
added 30 characters in body
Link

creating Creating rule-based sublists

added 30 characters in body
Source Link

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 lislis whose first element starts with "a""a":

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

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

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...

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.

Source Link
Suite401
  • 5k
  • 9
  • 20

creating rule-based sublists

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...