Occurrence of a substring inside a list of strings
- To: mathgroup at smc.vnet.net
- Subject: [mg51203] Occurrence of a substring inside a list of strings
- From: János <janos.lobb at yale.edu>
- Date: Fri, 8 Oct 2004 02:54:53 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I have a simple list of strings like lst={"abc", "abcd", "aabccaddbacdda", "adbacca",....}. Let's say I have a fragment called frag="dba". I would like to know how many strings in lst contain minimum once the fragment frag. This is what I did: Length[Flatten[Map[Part[StringPosition[#, frag], All, 1] &,lst] ] ] Is there a better/faster way to calculate it ? Thanks ahead, János ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice)
- Follow-Ups:
- Re: Occurrence of a substring inside a list of strings
- From: DrBob <drbob@bigfoot.com>
- Re: Occurrence of a substring inside a list of strings
- From: Andrzej Kozlowski <akoz@mimuw.edu.pl>
- Re: Occurrence of a substring inside a list of strings