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


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

Re: String Deletion

From Tomas Garza <tgarza10@msn.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: String Deletion
Date 2011-09-19 11:05 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j577l2$j3a$1@smc.vnet.net> (permalink)
References <201109171027.GAA26051@smc.vnet.net>

Show all headers | View raw


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.
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web