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


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

Re: String Deletion

Started byBob Hanlon <hanlonr@cox.net>
First post2011-09-18 08:19 +0000
Last post2011-09-18 08:19 +0000
Articles 1 — 1 participant

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


Contents

  Re: String Deletion Bob Hanlon <hanlonr@cox.net> - 2011-09-18 08:19 +0000

#5056 — Re: String Deletion

FromBob Hanlon <hanlonr@cox.net>
Date2011-09-18 08:19 +0000
SubjectRe: String Deletion
Message-ID<j549ik$6d4$1@smc.vnet.net>
list = List["Z:XBREG", "Z:XBREH", "Z:XBREI", "Z:ZZ6P", "Z:ZZ6Q", 
   "aye"];

Select[list, StringFreeQ[#, ":"] &]

{"aye"}

Cases[list, _?(StringFreeQ[#, ":"] &)]

{"aye"}

DeleteCases[list, _?(! StringFreeQ[#, ":"] &)]

{"aye"}


Bob Hanlon

---- Don <donabc@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.

[toc] | [standalone]


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


csiph-web