Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

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
> 
> 


  • Prev by Date: Re: Re: Re: Why does mathematica randomly rewrite notebooks?
  • Next by Date: Nested iterators in Compile
  • Previous by thread: Re: substrings at the end of words
  • Next by thread: Re: substrings at the end of words