Re: String Deletion
- To: mathgroup at smc.vnet.net
- Subject: [mg121522] Re: String Deletion
- From: Thomas Dowling <thomasgdowling at gmail.com>
- Date: Sun, 18 Sep 2011 04:12:23 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201109171027.GAA26051@smc.vnet.net>
Some possibilities: list=List["Z:XBREG","Z:XBREH","Z:XBREI","Z:ZZ6P","Z:ZZ6Q","aye"]; Select[list, FreeQ[Characters@#,{___,":",___}]&] or Select[list,!StringMatchQ[#,StringExpression[__,":",___] ]&] or Select[list,StringFreeQ[#,StringExpression[__,":",___] ]&] or DeleteCases[list,_?(StringMatchQ[#,StringExpression[___,":",___] ]&)] Tom Dowling On Sat, Sep 17, 2011 at 11:27 AM, Don <donabc at comcast.net> wrote: > Given a simple list of strings: > > list = List["Z:XBREG","Z:XBREH","Z:XBREI","Z:ZZ6P","Z:ZZ6Q","aye"] > > how does one delete all the strings with a colon (:) anywhere in the > string? > > DeleteCases[list, ___:___] looks very logical and should work, > but of course it doesn't . > > Also, there is a StringCases function which would seem > to correspond with the Cases function. There is a > DeleteCases function but no string counterpart, namely, > DeleteString function. Any reason for this? > > Thanks in advance. > >
- References:
- String Deletion
- From: Don <donabc@comcast.net>
- String Deletion