|
[Date Index]
[Thread Index]
[Author Index]
Using Cases or Position to Find Strings in a List of Strings
- To: mathgroup at smc.vnet.net
- Subject: [mg119514] Using Cases or Position to Find Strings in a List of Strings
- From: Gregory Lypny <gregory.lypny at videotron.ca>
- Date: Tue, 7 Jun 2011 06:48:23 -0400 (EDT)
Hello everyone,
I have a list of strings called myListOfFilePaths and I want to find
which one of those strings ends in ".DS_Store" (a hidden file created by
the Mac OS). I can pick it off using Select as
Select[myListOfFilePaths, StringMatchQ[#, ___ ~~ ".DS_Store" ~~
EndOfString] &]
but I can't do it using Cases or Position
Cases[myListOfFilePaths, ___ ~~ ".DS_Store" ~~ EndOfString]
Position[myListOfFilePaths, ___ ~~ ".DS_Store" ~~ EndOfString]
despite the fact that Head[___ ~~ ".DS_Store" ~~ EndOfString] is StringExpression. What am I doing wrong?
Regards,
Gregory
Prev by Date:
replace with closest value
Next by Date:
Select positive solutions (depending on parameters)
Previous by thread:
Re: replace with closest value
Next by thread:
Re: Using Cases or Position to Find Strings in a List of Strings
|