 
 
 
 
 
 
Re: substrings at the end of words
- To: mathgroup at smc.vnet.net
- Subject: [mg55006] Re: [mg54960] substrings at the end of words
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 9 Mar 2005 06:34:31 -0500 (EST)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
This may be what you want:
a={"edit","listed","called","wedding"};
Select[a,StringTake[#,-2]=="ed"&]
{listed,called}
Cases[a,_?(StringTake[#,-2]=="ed"&)]
{listed,called}
Bob Hanlon
> 
> From: fartous at mail15.com
To: mathgroup at smc.vnet.net
> Date: 2005/03/08 Tue AM 05:03:45 EST
> To: mathgroup at smc.vnet.net
> Subject: [mg55006] [mg54960] substrings at the end of words
> 
> a = {"edit", "listed", "called", "wedding"}
> StringCases[a, _ ~~ "ed"]
> Out[]= {{}, {ted}, {led}, {wed}}
> i want to extract only the "ed" string which located only at the end of the 
> words, i could not do that using the above code.
> thanks
> jack
> 
> 

