Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #14053
| From | Joug Raw <jougraw@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | find position in a list made by string by searching incomplete string |
| Date | 2013-04-04 17:10 +0000 |
| Message-ID | <kjkc5e$7mu$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
I have a list of strings like
list1={{"a", "b something", "a", "a", "b", "c", "b"}
In this list, 'something' is a sting that I will not know in advanced and
there are several spaces between the 'b' and the 'something' in one string.
The number of the spaces is unknown.
I want to find out the position of the this "b something" sting in the
list. So, I did,
Position[list1, "b*"]
and I also tried,
Position[list1,"b"~~___ ]
both of them gave me {} as results.
Also Cases[list1,"b"~~___] or Cases[list1, "b*"] does not work. I can get
the correct position only if I give the exact "b something" as the
searching pattern. What is the easiest way to search with a incomplete
string pattern in this case? Thanks for your help.
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
find position in a list made by string by searching incomplete string Joug Raw <jougraw@gmail.com> - 2013-04-04 17:10 +0000 Re: find position in a list made by string by searching incomplete string debguy <johnandsara2@cox.net> - 2013-04-05 02:30 +0000 Re: find position in a list made by string by searching incomplete Peter Pein <petsie@dordos.net> - 2013-04-05 02:30 +0000
csiph-web