MathGroup Archive 2011

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

Search the Archive

Re: String Deletion


A quick answer to your first question:
In[1]:= list=List["Z:XBREG","Z:XBREH","Z:XBREI","Z:ZZ6P","Z:ZZ6Q","aye"]
Out[1] {Z:XBREG,Z:XBREH,Z:XBREI,Z:ZZ6P,Z:ZZ6Q,aye}
In[2]:= list[[#]]&/@Position[StringCases[#,x_/;x==":"]&/@list,{}]Out[2]= {{aye}}
-Tomas
> Date: Sat, 17 Sep 2011 06:27:08 -0400
> From: donabc at comcast.net
> Subject: String Deletion
> To: mathgroup at smc.vnet.net
>
> 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: Eliminate works but Solve does not?
  • Next by Date: Re: Styling initialization cells
  • Previous by thread: Re: String Deletion
  • Next by thread: Re: String Deletion