MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: String Deletion

Some possibilities:


Select[list, FreeQ[Characters@#,{___,":",___}]&]


Select[list,!StringMatchQ[#,StringExpression[__,":",___] ]&]


Select[list,StringFreeQ[#,StringExpression[__,":",___] ]&]


DeleteCases[list,_?(StringMatchQ[#,StringExpression[___,":",___] ]&)]

Tom Dowling

On Sat, Sep 17, 2011 at 11:27 AM, Don <donabc at> 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.

  • Prev by Date: Re: String Deletion
  • Next by Date: Re: Making a function from the output of the Fit function.
  • Previous by thread: Re: String Deletion
  • Next by thread: Re: String Deletion