Skip to main content
deleted 9 characters in body
Source Link
C. E.
  • 71.2k
  • 6
  • 141
  • 269

Some options:

Pick[
 lis,
 StringStartsQ[lis[[All, 1]], "a"]
 ]

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

Select[lis, StringStartsQ[First[#], "a"] &]

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

Cases[lis, m : {_?(StringStartsQ["a"]), ___} :> m]]

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

Some options:

Pick[
 lis,
 StringStartsQ[lis[[All, 1]], "a"]
 ]

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

Select[lis, StringStartsQ[First[#], "a"] &]

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

Cases[lis, m : {_?(StringStartsQ["a"]), ___} :> m]

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

Some options:

Pick[
 lis,
 StringStartsQ[lis[[All, 1]], "a"]
 ]

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

Select[lis, StringStartsQ[First[#], "a"] &]

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

Cases[lis, {_?(StringStartsQ["a"]), ___}]

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

Source Link
C. E.
  • 71.2k
  • 6
  • 141
  • 269

Some options:

Pick[
 lis,
 StringStartsQ[lis[[All, 1]], "a"]
 ]

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

Select[lis, StringStartsQ[First[#], "a"] &]

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

Cases[lis, m : {_?(StringStartsQ["a"]), ___} :> m]

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