Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5069 > unrolled thread

Re: String Deletion

Started byTomas Garza <tgarza10@msn.com>
First post2011-09-19 11:05 +0000
Last post2011-09-19 11:05 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: String Deletion Tomas Garza <tgarza10@msn.com> - 2011-09-19 11:05 +0000

#5069 — Re: String Deletion

FromTomas Garza <tgarza10@msn.com>
Date2011-09-19 11:05 +0000
SubjectRe: String Deletion
Message-ID<j577l2$j3a$1@smc.vnet.net>
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@comcast.net
> Subject: String Deletion
> To: mathgroup@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.
>

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web