Re: How to get position of string in a mixed list? (string pattern
- To: mathgroup at smc.vnet.net
- Subject: [mg96219] Re: How to get position of string in a mixed list? (string pattern
- From: dh <dh at metrohm.com>
- Date: Mon, 9 Feb 2009 05:37:41 -0500 (EST)
- References: <gmndli$s1k$1@smc.vnet.net>
Hi,
try.
Position[{"a", "abc", "dfe", "nab", 1, 2, 3, {1, 2}},
x_String /; StringCount[x, "ab"] > 0]
hope this helps, Daniel
goodhei8 at gmail.com wrote:
> for list like {"a","abc","dfe","nab",1,2,3,{1,2}}, I want to get all
> strings' position in the list which match a pattern (like
> ___~~"ab"~~___). How to do it? How to use a string pattern in a list
> pattern? how to use a pattern with a condition (both list pattern&/;
> StringQ[#] and list pattern /;StringQ[]&, no working for me)
>
> Thanks.
>